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.

Comments

jive01 created an issue. See original summary.

jive01’s picture

StatusFileSize
new43.75 KB
jive01’s picture

Issue summary: View changes
stewest’s picture

StatusFileSize
new18.16 KB

Hi.

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.

conditional-rendering

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