Skip Navigation

[Resolved] Types Conditional Block

This support ticket is created 2 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by acts-1224C 2 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2182397

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

#2182597

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/

#2182863

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.

#2183363

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

#2183849

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

#2184317

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/

#2185771

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.