Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

User not role

158 sites Security covered Drupal 11 · not 10
View on drupal.org

This module adds a condition to control block visibility based on user roles. It allows site builders to hide blocks from users who have specific roles, providing a more nuanced way to manage content display.

Provides a "User Not Role" condition that acts in the opposite behavior of the Drupal core "User Role" condition. A site builder may add this to their block visibility settings to only display a block for users that do not have a role.

Common scenario: A user has two roles: "shouldshow" and "shouldhide". There is a block that should only display to "shouldshow", but not "shouldhide".

Solution: Configure the block with the "User Role" visibility setting to "shouldshow" and the "User Not Role" visibility setting to "shouldhide".

Result: The block will not be displayed because the user has the "shouldhide" role even though they also have the "shouldshow" role.

Configuration

  1. Enable the module on the Adminsitration > Extend page.
  2. Go to the Administration > Structure > Block layout page.
  3. Press the Configure button for a block.
  4. Click the "User Not Role" vertical tab.
  5. Select roles that a user must not have to display the block.
  6. Press the "Save block" button.

Technical documentation

This takes the intersection of the configured roles and a user account's roles. If there is no intersection between the two, then the user must not have the role and the condition passes.

When negated, the opposite occurs. If there is no intersection, the condition fails.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Nov 2024
Latest release
2 months ago
Releases (12 mo)
1 ▼ from 3
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
2.0.1 Stable 11 Jun 19, 2026
2.0.0 Stable 11 Jun 13, 2025
2.0.0-alpha1 Pre-release 11 Nov 14, 2024
1.0.1 Stable 10–11 Nov 14, 2024