[SOLVED] Help needed on Text field Value Layout

6 days 16 hours ago - 5 days 16 hours ago #315545 by liaskas

i am trying to set what a field shows on profile view

** viewaccesslevel 18 is paid member

[cb:if user="#me" user_id<="0"]You are not logged-in! -> (This is what guests see)
[cb:elseif user="#me" user_id!~"/Admin1_id|Admin2_id/"] [/cb:elseif] -> (field not to show for super users)
[cb:elseif user="#me" user_id="myid"] [/cb:elseif] -> (field not to show for profile owner)
[cb:else user="#me" viewaccesslevel !includes "18"]An active subscription is required...[/cb:else] -> (What the field shows when viewer does not have an active subscription and all previous conditions are not met)

The above works only for guest users. Please advise as my brain has started melting!

Thank you
6 days 16 hours ago #315546 by Astrid
As far as I know you should use
cb:if user="#displayedOrMe"
6 days 15 hours ago #315548 by liaskas
Thank you for your reply Astrid, but this does not seem to have any effect.

The first condition works fine. Guests see what they have to see. Nothing else works.

Any other ideas?
6 days 14 hours ago #315551 by krileon

[cb:if user="#me" user_id<="0"]

This will work fine since you're checking the viewing users user id against 0.

[cb:elseif user="#me" user_id!~"/Admin1_id|Admin2_id/"] [/cb:elseif]

This should also work. You're checking that the viewing users user id isn't in the supplied list.

[cb:elseif user="#me" user_id="myid"] [/cb:elseif]

This will never work. You're checking that the viewing user isn't them self, which makes no sense. "user" should be set to #displayed if you're trying to be sure the viewing user isn't the currently displayed user.

[cb:else user="#me" viewaccesslevel !includes "18"]

This will never work as else can not have conditions. This should be an elseif.

Please keep in mind forcing "user" to "#me" means all the conditions are against the viewing user. They will never be against the displayed user (the profile owner). You can condition against the displayed user by omitting the "user" parameter or setting it to #displayed. You can condition against the viewing user when not viewing a profile and conditioning against the displayed user while viewing a profile with #displayedOrMe.

Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Templates - CBSubs - Hosting - Forge - Incubator - GroupJive
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 EST to 4:00 PM EST. 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.
6 days 11 hours ago #315560 by liaskas
Thank you!

Case solved successfully.
The following user(s) said Thank You: krileon
Moderators: beatnantkrileon
Time to create page: 0.431 seconds
Facebook Twitter Google LinkedIn