How do you hide a block based on user role. We've tried using tokens and conditions without success. Needs better documentation. I've attached our values that are not working.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | conditional-rendering.jpg | 18.16 KB | stewest |
| #2 | cond-rend-hide-anonymous.png | 43.75 KB | jive01 |
Comments
Comment #2
jive01 commentedComment #3
jive01 commentedComment #4
stewestHi.
I found that I had to create/add the block inside of Layout Builder (i.e. via the Layout builder side bar), and set the conditional formatting there.
I.e. it doesn't seem to work if I set the conditions via the block content config form at /admin/content/block ....
I used "not contains" in [current-user:roles] and a certain role's machine name. It might be more user friendly if the dropdown was a generated list of options.
then when I do want it to show for a certain role, I used "contains" options in property = [current-user:roles] and value club_admin