By accepting you will be accessing a service provided by a third-party external to https://magazine.joomla.org/
CB Delimiter Field Magic
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 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.
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 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.
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.