Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

This module allows you to control which user roles can view the profiles of users belonging to specific roles. It grants a permission for each custom role, enabling fine-grained control over profile visibility. Users can always view their own profiles, and administrators with the "Administer users" permission are unaffected.

Provides a permission per user role that controls whether a visitor can view
the profile of users who carry that role.

How it works

When this module is enabled, one permission is generated for every custom role
(excluding the built-in *Anonymous* and *Authenticated* roles):

View user profiles with role [Role name]

A viewer may see a profile if they hold the permission for at least one of
the profile user's roles. If the profile user has no custom roles the module
defers to Drupal core's own access rules.

Example

Viewer role Permission granted Can view Author profiles Can view Administrator profiles Anonymous
  • view user profiles with role author
Yes No Authenticated
  • (none)
No No Manager
  • view user profiles with role author
  • view user profiles with role administrator
Yes Yes

Configuration

Requires Drupal 11.1+ (uses OOP hooks via PHP attributes).

  1. Enable the module: `drush en access_user_profiles_by_role`
  2. Go to Administration → People → Permissions
  3. Grant the desired View user profiles with role … permissions to the appropriate roles.

Notes

  • Users can always view their own profile regardless of these permissions.
  • Users with the Administer users permission are unaffected; core handles their access as usual.
  • Permissions are generated dynamically, so adding or removing a role will update the permissions list after a cache rebuild (drush cr).

Activity

Tracked releases
1
Tracked since
Mar 2026
Latest release
4 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Mar 25, 2026