substitution with [username] doesn't work

3 years 6 months ago #320945 by ericmuc
Hi,

I tried a lot and in my view this should work:

In a custom html field I added "[cb:if user="#displayedOrMe" user_id>"0"][username][/cb:if]" (togehter with more info, so I don't use the username field itself)

So username shall be visible only for logged in users, not for guests.

But the username is shown always.

What is wrong? Would be nice if you help.

Thanks, best regards
Eric

Please Log in to join the conversation.

3 years 6 months ago #320946 by ericmuc
Replied by ericmuc on topic substitution with [username] doesn't work
ok, NOW I found the info, doesn't work, I am using the CB content module ...

Please Log in to join the conversation.

3 years 6 months ago #320954 by krileon
Replied by krileon on topic substitution with [username] doesn't work

In a custom html field I added "[cb:if user="#displayedOrMe" user_id>"0"][username][/cb:if]" (togehter with more info, so I don't use the username field itself)

That IF condition will never fail. You're using #displayedOrMe and when it comes to a field the #displayed is always the profile owner. What are you trying to do exactly? Only show that if someone is logged in? If that's the case the below is what you'd use.

[cb:if user="#me" user_id>"0"][username][/cb:if]

ok, NOW I found the info, doesn't work, I am using the CB content module ...

That IF condition should work fine in CB Content Module, but it's still going to work as explained above if it's inside of a Custom HTML field being substituted into a CB Content Module. The #displayed part is checking for what user profile is being viewed and the OrMe part is checking the user viewing the page. So if you're viewing a profile it will display the username of the profile displayed otherwise it will show the username of the person logged in.

See the substitution tutorial below for further usage information.

www.joomlapolis.com/documentation/279-community-builder/tutorials/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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.175 seconds

Facebook Twitter LinkedIn