The Joomla! ® Community Magazine

CB Delimiter Field Magic

Written by | Tuesday, 03 August 2010 04:57 | Published in 2010 August
Level of Difficulty:Advanced Community Builder is the most popular extension for Joomla (at the time this article was published). It is filled with features that will help Joomla websites manage online communities. One of the most powerful but perhaps also most overlooked feature is its “delimiter” field. As a member of the CB Team I have used the delimiter field concept on many occasions to address various use cases. This is the first of a series (2 or more depending on interest expressed) article that will give small use case examples regarding potential use of this powerful feature that will hopefully inspire readers to further investigate.

The Basics

The CB delimiter field by itself is basically a field that can display specific HTML code in it. It differs from the “normal” CB field types (text, image, file, rating, integer, date, etc.) as it does not permit user editing. So what’s so hot about a field that no one can edit?

This by itself might not sound like much, but when combined with CB field substitutions a delimiter field allows website administrators to create some powerful personalized CB user profile messages that adjust themselves based on who is viewing them.

The Use Case

The CB delimiter use case we will deal with in this article will create a field that will personally greet profile viewers when they visit other member's profiles. The message will look something like:

Hi John (assuming John is the first-name of the member logged in and doing the viewing), welcome to my profile. I am Susan (assuming that Susan is the first-name of the member’s profile being viewed) and I am XX years old and I live in Greece.

The Environment

This small use case and the screenshots given as based on the following configuration elements:

  • CB 1.2.3 is installed and properly configured on a Joomla 1.5.20 website (basic configuration instructions are included in the CB 1.2.3 distribution package)
  • CB is configured to support first-name / last-name formatted names (instead of the Joomla default single name structure)
  • CB is configured to add a ‘cb_age’ date field to all user profiles
  • CB is configured to add a ‘cb_country’ text field to all user profiles

The CB Delimiter Field

The delimiter field doing this magic has been configured to display the following message:

Hi [cb:userdata field="firstname" user="#me" /] , welcome to my profile. I am [cb:userdata field="firstname" /] and I am [cb:userfield field="cb_age" /] old and I live in [cb:userfield field="cb_country" /].

The underlined portions contain CB field substututions that will be automatically populated by CB when rendering a user profile to a viewer. More details regarding the entire setup of the field and the tab are provided in the image gallery attached at the end of this article.

The Results

The result is illustrated in the following figures that show what Lisa Johnson would see when visiting John Smith's profile and what John would see when he visits Lisa's profile.

cbdelimiter-2

 

cbdelimiter-3

Conclusions

We have seen how a CB Delimiter field can be used by a CB administrator to create nice persoanlized messages that appear as if they are prepared by the profile owner greeting the profile visitor.

In the next series we will show how a CB delimiter field can be used to provide a Youtube playlist player on each user profile. Until then, I hope this "Did You Know ..." article has inspired you.

 

Read 22887 times
Tagged under Did you know...?
Nicholas G. Antimisiaris

Nicholas G. Antimisiaris

Nick, an Electrical Engineer and Computer Science veteran with extensive experience in the Telecommunications / Software industry in US and Greece, has been involved with opensource projects since 2002 and is loving it. He is a member of the Community Builder team on Joomlapolis as is known as nant in the Joomla universe.

Leave a comment

Make sure you enter the (*) required information where indicated.

[b] [i] [u] [s] [url] [quote] [code] [img]   

Comments (11)

  • avatar
    • 0
    • 0
    Mokum

    Wow thanks for sharing this - another thing I didnt know about CB!
    I am going to experiment with this;)

  • avatar
    • 0
    • 0
    Ornulf Bratlie

    Thanks, exactly the explanation - and function - I needed. Can't wait for the next article!

  • avatar
    • 0
    • 0
    Greg Owens

    Excellent well presented article. Thank you for the screen shots as well. I've been using CB for 3 years and learned something today by reading this. Thanks!

  • avatar
    • 0
    • 0
    pepperstreet

    Thank you very much.

    Please, publish more about delimiters and CB Substitutions!!! There is only one FAQ about it and too little real world examples. In my humble opinion, the best and most underrated feature in CB!

  • avatar
    • 0
    • 0
    IgorPR

    Great Post :D

    I'll be waiting for the next post.

  • avatar
    • 0
    • 0
    johnnydement

    I'm expecting the next thanks!

    Would I be able to create "proxy" fields that then would populate delimiter fields?

    more voer, could I create a field where you fill text, and a delimiter that would show a symbol depending on the introduced text?

    Also, is there any way to find docu on this? doc suscriber manual explains not much...

  • avatar
    • 1
    • 0
    Nicholas G. Antimisiaris

    @johnnydement:

    Yes you can have other CB fields gathering input for a delimiter field.

    And as the delimiter field supports HTML code, you can use it to show a specific image based on a specific CB Field value.

    This first will become clear in the next Delimiter field magic article (YouTube playlist in profile) and the second can be accomplished using CB substitution if statement in a delimiter field.

  • avatar
    • 0
    • 0
    Peter

    Thanks for the info!

    Is it also possible tot use CB Delimiter to ask a payment when a user want to send messages tot another user?

    Or to ask a payment for visiting the profile of another user?

    Thanks!

  • avatar
    • 2
    • 0
    Calgary Web Design

    Beautiful!
    I was just looking for a way to pass Varibales to an iFrame (Which you can also load with Delimiters - HUGE+++) And had no idea that CB already had some pre-defined systems for this - YOU ROCK!!!

  • avatar
    • 0
    • 0
    Mark Sinnard

    This was a very useful article. I have a question.
    I'd like to use the field substitutions and delimiter field magic to assemble a URL, similar to this:
    http://mysite.com/watchmebutton.php?viewer_name=[cb:userdata field="name" user=#me /]&profile_name=[cb:userdata field="name" /]... and other similar fields.
    I know this doesn't work, but is there a way to make this work?
    thanks

  • avatar
    • 0
    • 0
    Nicholas G. Antimisiaris

    enter your message here...

    Mark Sinnard wrote:
    This was a very useful article. I have a question.
    I'd like to use the field substitutions and delimiter field magic to assemble a URL, similar to this:
    http://mysite.com/watchmebutton.php?viewer_name=[cb:userdata field="name" user=#me /]&profile_name=[cb:userdata field="name" /]... and other similar fields.
    I know this doesn't work, but is there a way to make this work?
    thanks

    Please post on Joomlapolis forums for assistance.