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: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). 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. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Reference Blocked Users

349 sites Security covered Drupal 10–11
View on drupal.org

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.

Small Module, Big Headache Relief for Editorial Settings

This is a small module but it will save you a big headache, especially in editorial settings.

There are two places you'll be looking for entity reference users:

Authored By Field

The first field is "authored by", found under authoring information. It's available in any content type you create. In order to see that field as a content editor, you must have the permission to "administer content".

Custom Entity Reference User Field

The second place where you will need to reference users is to add a custom field in a content type as an entity reference user. This field has a configuration form that asks you to fill out "reference method", "filter by", and "sort by".

In Drupal core, /core/modules/user/src/Plugin/EntityReferenceSelection/UserSelection.php this plugin provides the entity selection for the user. In order to view all users, blocked/active, you must have the permission "administer users".

<pre class="codeblock"><code class="language-php">if (!$this-&gt;currentUser-&gt;hasPermission('administer users')) {
    $query-&gt;condition('status', 1);
}

Why Did I Create This Module?

I want content editors to have the ability to reference all users (blocked and active) in the Authored by field or in any custom entity reference user field.

There is some work available on Drupal to create a patch that gives you the ability to include the blocked users in the configuration form for the custom field. But, there is no solution for the "authored by" field, because the authored by field does not have a configuration form. Read more about the issue here.

I wanted one solution for both scenarios (the "Authored by" and the custom entity reference user"). The solution is to create a custom permission that can be assigned to any role in the system, that allows that role to reference all users (blocked and active). That's what this module does.

What's New in 2.0

  • Search by email address: for anyone holding the permission, the user autocomplete now matches on the email address as well as the username. Drupal core only ever matches the username, but editors often remember a person by their email.
  • Drupal 12 ready: the selection plugin now uses the modern #[EntityReferenceSelection] PHP attribute instead of the deprecated annotation, and ships with automated test coverage.

Requirements

Drupal 11.3 or 12. No other dependencies. (Need Drupal 9 or 10? Use the 1.x branch.)

Permissions

Grant the "Reference blocked users" permission to any role that should be able to reference active and blocked users in user reference fields, including "Authored by". Users who already have Administer users keep Drupal core's default behavior.

Testing Process

Login as an Admin and Create Four Users and One Role

Install the module and apply the permission to the editor role.

Create Two Entity Reference User Fields Inside Article Content Type

We are testing the configuration and the new permission.

First Field: Include Anonymous User and All Roles in the Configuration Form

Second Field: Exclude Anonymous User and Filter by Editor Role Only in the Configuration Form

Logout and Sign In as an Editor and Try to Add or Edit an Article

For Authored By Field, the Field Will Reference All Users

For the First New Added Field, the Field Will Reference All Users

For the Second New Added Field, the Field Will Reference All Editors

Search by Username or Email

In any of these fields, start typing either a username or an email address and the matching user will appear in the autocomplete, active or blocked.

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.

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
3
Tracked since
Jan 2025
Latest release
1 month ago
Releases (12 mo)
2 ▲ from 1
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
2.0.0-rc1 Pre-release 11 Jul 7, 2026
2.0.x-dev Dev 11 Jul 7, 2026
1.0.5 Stable 10–11 Jan 20, 2025