I need to have the conditional block performing a task allowing a user to see data at the level of their permission.
However it only works with user having just one role. My website has a few users (managers) who has additional roles and the conditional block does not accept that.
The documentation on toolset site says it works but it s not working.
I have tried to create a statement with "or" and "and" for the roles but it does not respond to the intended operation.
Thanks
Hello,
You can try Access shortcode [toolset_access], for example:
[toolset_access role="Author,Contributor" operator="allow"]
Display something if current user has role Author or Contributor
[/toolset_access]
[toolset_access role="Author,Contributor" operator="deny"]
Display something if current user does not has any role in Author or Contributor
[/toolset_access]
You can download Toolset Access plugin here:
https://toolset.com/account/downloads/
Thanks Luo,
I do have all plugins installed included Access.
Now, just for me to understand. This short code I have to install it in the custom snippet code at the toolset settings? Is this a temporary fix until the you guys fix the broken paths? It sounds a little counter productive. I will end up with 30 to 50 different snippets if not more every time I need to make a conditional operation. My site has 20 post types for 10K internal users with 18 different permission levels. it can easily become problematic if I don't have a normalized solution for this problem.
Maybe Toolset could come up with better alternatives once it is advertised you can work with users having multiple role.
The [toolset_access] shortcode is a built-in feature of Toolset Access plugin, it does not other custom codes.
For the new question:
Is this a temporary fix until the you guys fix the broken paths?
Please elaborate the question with more details, provide detail steps to reproduce the same problem: broken paths
Thanks for helping me Luo, let me see if I understand and I don't want mix things in this conversation.
You provided me with this code:
[toolset_access role="Author,Contributor" operator="allow"]
Display something if current user has role Author or Contributor
[/toolset_access]
[toolset_access role="Author,Contributor" operator="deny"]
Display something if current user does not has any role in Author or Contributor
[/toolset_access]
Where can I install or add this code since it is an Toolset Access specific code? Do I use it normally as a statement in the field and text toolset block and access will recognize it and process the statement?
Also, if I need to tweak it to other types of combinations I can just add additional permissions to it right? Also, the role in the code is the display role name or the ID of the role?
thanks
You can use Toolset Content Template to setup those shortcode within classic editor UI, for example:
1) Dashboard->Toolset-> Settings-> General, in section "Editing experience", enable option: Show both the legacy and Blocks interface and let me choose which to use for each item I build
2) Dashboard->Toolset-> Content Templates, create a content template, edit it with classic editor by clicking "Use the Classic Editor for this Template", you should be able to see the button "Access", use it you can setup the [toolset_access] shortcode with UI.
Then you can copy/paste those shortcodes into the content with a WP shortcode block:
https://wordpress.org/support/article/shortcode-block/
My issue is resolved now. Thank you!