Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

[SOLVED] Substitution userlist description

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
10 years 10 months ago - 10 years 10 months ago #238446 by KatoKalin
I was trying to use substitution in the description of the userlist as it is shown in the documentation page 178. I have a field cb_country and have entered [cb_country] into the description field. However it returns only [cb_country] when I check the description in the frontend.

Also I would like to use language variables in the description. This did not work either.

What am I doing wrong?

Edit: Ok, silly me! For some reason I was not logged in when I tried this.... :whistle:
With a user logged in it works as expected. However this shows that in case a user is not logged in the output is quite errrrr useless.

So my questions stands now as: How can I use language strings in the description and how can I use different text for logged in users and guests.
Last edit: 10 years 10 months ago by krileon.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
10 years 10 months ago #238488 by krileon
Replied by krileon on topic Substitution userlist description

So my questions stands now as: How can I use language strings in the description and how can I use different text for logged in users and guests.

You can't use multiple language strings anywhere in CB at once. You need to create 1 language string and use that language string as your description. Then in the definition of your language string you'd add your substitutions as needed. Example define usage as follows.

Code:
define( '_UE_MYLIST', 'Hello, [name] this is a userlist!' );

Then you'd add _UE_MYLIST as your userlist description. All places that use define usage can also use CBTxt usage assuming the string isn't defined so you could also do the following.

Code:
'Hello, [name] this is a userlist!' => 'Hello, [name] this is a userlist!'

Then use "Hello, [name] this is a userlist!" as your description.

Next to have descriptions with substitutions that are only used for login users you need to use IF substitution statements as follows.

[cb:if user="#me" user_id>"0"]I am logged in.[/cb:if]

See the below substitution tutorial for further information (IF substitution examples shown at bottom of page).

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • KatoKalin
  • KatoKalin
  • OFFLINE
  • Posts: 265
  • Thanks: 11
  • Karma: -5
  • Add-ons
10 years 10 months ago #238726 by KatoKalin
Replied by KatoKalin on topic Substitution userlist description
Ok now I got that working. Thanks.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum