0

I have some custom roles such as Premium Membership and I don't want to allow access to this category.

The authenticated role is included to Premium Membership or Moderator users because every registered user has this authenticated role assigned to them by default.

I want to hide a block and display only for authenticated users that do not have other roles assigned to them.

What can I do?

0

Visibility Block base on the Role is built-in Drupal 8 feature.

go to admin/structure/block and click on your desire block configure button

enter image description here

then in Visibility section, there is Role that you can define for which role your module show , or not to show.

enter image description here

| improve this answer | |
  • Yes, but you didn't understand my question. If I allow only for authenticated users, which I need, it will allow automatically to Premium Membership users because they have the same role: Authenticated User. I want to exclude this role: Premium Membership. – Reflex Roland Mar 28 at 19:47
  • @ReflexRoland programmatically revoke authenticated role when a user is assigned a premium or moderator role and conversely assign authenticated role when user is revoked premium or moderator role. – No Sssweat Mar 28 at 22:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.