Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

[SOLVED] Help needed on Text field Value Layout

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
4 years 11 months ago - 4 years 11 months ago #315545 by liaskas
Hello...

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)
[/cb:if]

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

Thank you
Last edit: 4 years 11 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • Astrid
  • Astrid
  • OFFLINE
  • Posts: 183
  • Thanks: 68
  • Karma: 10
4 years 11 months ago #315546 by Astrid
Replied by Astrid on topic Help needed on Text field Value Layout
As far as I know you should use
Code:
cb:if user="#displayedOrMe"

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

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
4 years 11 months ago #315548 by liaskas
Replied by liaskas on topic Help needed on Text field Value Layout
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?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 11 months ago #315551 by krileon
Replied by krileon on topic Help needed on Text field Value Layout

[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 - 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.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 391
  • Thanks: 36
  • Karma: 2
  • Add-ons
4 years 11 months ago #315560 by liaskas
Replied by liaskas on topic Help needed on Text field Value Layout
Thank you!

Case solved successfully.
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum