Substitutions
Technical documentation
09 May 2010
Community Builder supports substitutions in many locations such as delimiter fields, field titles, cb content module, and more. There are substitutions for simple to advanced and complex capabilities for displaying fields or even tabs. The following will diminstrate how to use CB Substitutions properly and to their fullest extend as well as examples of these usage scenarios. All tests are performed in the CB Content module.
Simple Raw Field Value
[FIELD_NAME]
The user [username] lives in [cb_citystate] and his name is: [name].
The user BobTBurns lives in Springfield, OH and his name is: Bob.
Raw Field Value
[cb:userdata field="FIELD_NAME" /]
The user [cb:userdata field="username" /] lives in [cb:userdata field="cb_citystate" /] and his name is: [cb:userdata field="name" /].
The user BobTBurns lives in Springfield, OH and his name is: Bob.
Original Field Value
[cb:userfield field="FIELD_NAME" /]
The user [cb:userfield field="username" /] lives in [cb:userfield field="cb_citystate" /] and his name is: [cb:userfield field="name" /].
The user BobTBurns lives in Springfield, OH and his name is: Bob.
In addition to being able to display fields with the new substitutions method you have a multitude of parameters that can be added to extend the substitution requirements. These additionally parameters are required to provide usage of the IF substitution.
user - userid, #me, #displayed, #displayedOrMe
usertype
user_id - myid, ##
username
Parameters
[cb:userdata field="FIELD_NAME" user="REPLACEMENT" /]
The user [cb:userdata field="username" user="#me" /] lives in [cb:userdata field="cb_citystate" user="62" /] and his name is: [cb:userdata field="name" user="#me" /].
The user BobTBurns lives in Branson, MO and his name is: Bob.
Parameters are also affected by operators which can change the way the the data is displayed or if it's even displayed at all.
Operators
and, or, = , !=, , =
Tab
[cb:usertab tab="TAB_ID" user="REPLACEMENT" /]
[cb:usertab tab="17" user="#displayedOrMe" /]
Displays CBs Menu tab.
Ifs
[cb:if PARAMETER="REPLACEMENT"]TEXT/CODE[/cb:if]
[cb:if username="demo"]This is Demo being displayed.[/cb:if]
[cb:if user_id="myid"]This is Me being displayed.[/cb:if]
[cb:if user="#displayed" username="test"]This is Test being displayed.[/cb:if]
[cb:if user="#me" username="demo"]This is Demo watching.[/cb:if]
[cb:if user="#me" usertype="Super Administrator"]User of type: [cb:userdata field="usertype" /][/cb:if]
[cb:if user="#displayedOrMe" user_id="0"]I am A GUEST.[/cb:if]
[cb:if user="#me" username!="admin"]This is NOT Admin watching.[/cb:if]
There are many more possibilities. It's just a matter of trial and error to see what works for you.