Skip to Content Skip to Menu

How to configure Tab conditional show based on both user and who is displayed

  • kdave321
  • kdave321
  • OFFLINE
  • Posts: 189
  • Thanks: 24
  • Karma: 1
5 years 9 months ago #309461 by kdave321
We have set up 6 access levels in Joomla and I want to restrict who can see the connection request tab to those who are at or above the displayed users level.

I have already read the doc's and watched the tutorials, but I can't translate them to the tab configuration.

This does not work:
Field: Value
Custom Value: user="#displayed" viewaccesslevel
Translate Custom Value: No
Operator: Less Than or Equal To
Value: user="#me" viewaccesslevel
Translate Value: No

I also tried just "viewaccesslevel" on last Value there.

I am guessing what the values are from the documentation about -
[cb:if PARAMETER="REPLACEMENT"]TEXT/CODE[/cb:if]

, and the construct 'user="#displayed" username="test"' shows username of #displayed.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8277
  • Karma: 1443
5 years 9 months ago #309468 by krileon
Best I can suggest is something like the below.

Field: Value
Custom Value: [cb:if user="#me" viewaccesslevel includes "VIEWACCESSLEVEL_ID_HERE"]ALLOWED[cb:else]DENY_USER[/cb:else][/cb:if]
Operator: Equal To
Value: [cb:if viewaccesslevel includes "VIEWACCESSLEVEL_ID_HERE"]ALLOWED[cb:else]DENY_DISPLAYED[/cb:else][/cb:if]

This should allow the tab to display if both users have that view access level. Simply replace VIEWACCESSLEVEL_ID_HERE with whatever view access level you're trying to check against. See the substitution tutorial below for further substitution 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 or Create an account to join the conversation.

  • kdave321
  • kdave321
  • OFFLINE
  • Posts: 189
  • Thanks: 24
  • Karma: 1
5 years 9 months ago - 5 years 9 months ago #309480 by kdave321
OK, that sent me in the right direction. I had to test numerous values tho - not sure why that field supports only a subset of what's in the CB substituions document.

So I eventually realized the VIEWACCESSLEVELS is a list of GROUP ID's, and my group id's ( as I eventually defined them ) are not consecutive, ie, I have 5 levels allowed to see the tab - 4,5,6,16,17.

If anyone else is interested in using multiple levels, this worked for me:

I set Display = Tab conditional hide, and then added 4 OR'd rows like this:

Field: Value
Custom Value: [cb:if user="#displayed" viewaccesslevel includes "5"]5[cb:else]4[/cb:else][/cb:if]
Operator: Greater Than
Custom Value: [cb:if user="#me" viewaccesslevel !includes "5"]4[cb:else]5[/cb:else][/cb:if]

-> so, basically, each 2nd if ( note: NOT includes ) test changes to show maximum access level of the Viewer.

But now, instead of showing the Connection Path, I'd really just like a color-changing button that says either "Connected" or "Request Connection".

I also noticed this Tab Configuration is not changing what CB Menu shows...
Last edit: 5 years 9 months ago by kdave321. Reason: wrong word

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8277
  • Karma: 1443
5 years 9 months ago #309503 by krileon

So I eventually realized the VIEWACCESSLEVELS is a list of GROUP ID's, and my group id's ( as I eventually defined them ) are not consecutive, ie, I have 5 levels allowed to see the tab - 4,5,6,16,17.

You should be able to add the OR case directly to the substitution. Example as follows.

[cb:if user="#displayed" viewaccesslevel includes "4" or viewaccesslevel includes "5"]5[cb:else]4[/cb:else][/cb:if]

Once the View Access Level and Usergroup conditions can be based off the viewing users and/or the displayed user this will be easier to configure as you won't need the substitution usage at all.

I also noticed this Tab Configuration is not changing what CB Menu shows...

The Connections and Connections Path tab has no control over the menu item. There is no ACL for limiting who can connect at this time.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum