This module provides a permission to allow editors to reference both active and blocked users in user reference fields, including the "Authored by" field. It also enhances the user autocomplete to search by email address in addition to username.
Reference Blocked Users adds a permission that lets a role pick blocked users as well as active users in user reference fields and in the "Authored by" field. It is for editorial sites.
Editors who lack "Administer users" get Drupal's default user selection. Give them "Reference blocked users" instead, and they do not need broader user administration access.
Start here
- Read the Drupal core issue about referencing blocked users
- After installing, grant "Reference blocked users" to the role on the Permissions page
See it working
These steps show the permission on a test site with an editor role. They create two user reference fields on the Article content type and then sign in as an editor.
Create four users and one role
Install the module and give the editor role the permission
Create two user reference fields on the Article content type
The first field includes the anonymous user and all roles.
The second field excludes the anonymous user and filters by the editor role only.
Sign in as an editor and add or edit an article
The "Authored by" field, as the editor sees it.
The first new field, as the editor sees it.
The second new field, as the editor sees it.
Features
- Reference blocked users: A permission, described as "Permission to reference all users (active/blocked) in entity reference user field and in Authored by field". Grant it to any role.
- Selection plugin: The module adds a selection plugin named "Reference Blocked Users" for user reference fields. It applies to a user who has this permission and does not have "Administer users". Everyone else keeps Drupal's default behavior.
- Field options still apply: A field that excludes the anonymous user still excludes it, and a role filter still limits the list. Access checking stays on.
- Search by email address: For users the plugin applies to, typing text in the autocomplete matches the username or the email address.
- No settings page: The module has no settings page, no database updates and no submodules. The permission is the only control.
Installation: get started in 3 steps
- Install the module with Composer:
composer require drupal/reference_blocked_users - Enable it on the Extend page, or with Drush:
drush en reference_blocked_users - Open the Permissions page and grant "Reference blocked users" to the roles that should reference blocked users. Check it by editing an article as a member of that role.
Requirements
- Drupal 11.3 or later, including 12
- The PHP version your Drupal core requires
Reference Blocked Users needs no other modules or projects.
Support and maintenance
Questions, ideas, and bug reports are welcome. Please use this project’s issue queue so discussions and solutions remain available to the Drupal community.
Maintainers monitor issues, but response times depend on availability.
Developed and maintained by Alaa Haddad of Flash Web Center, LLC.
AI disclosure: AI tools assisted with drafting and reviewing this project description. The maintainer verified the final content against the project source.
Ask your assistant about Reference Blocked Users
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
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.