Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

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".

if (!$this->currentUser->hasPermission('administer users')) {
    $query->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.

back to top ☝️

Developed & Designed By: Alaa Haddad

A Personal Thank You for Your Support

Every project you see here, including this one, reflects countless hours of work driven by my passion for making Drupal better for everyone. Your support truly makes a difference, and there are a few simple ways you can help these projects grow and reach others who might benefit:

  • Use & Share Feedback: Have you found this project (or any of my other work) helpful? Let me know what worked well or how it could be improved. Real user input drives better tools for the entire community.
  • Click "Like" on Drupal.org: It may seem small, but liking this project on Drupal.org helps others discover and trust these tools.
  • Spread the Word: Share these projects on social media, Slack groups, or anywhere Drupal folks connect. Your word of mouth helps these tools find the people who need them.
  • Explore More of My Work: Check out my other projects on Drupal.org to see what else might support your workflow or inspire your next build.

W3CSS Theme (d8w3css) - Solo - W3CSS Paragraphs - Paragraphs Bundles - Amun - Amunet - Anhur - Acquia Purge Varnish - Cloudflare Purge - Reference Blocked Users - Solo Copy Blocks - Solo Utilities - PB Import - VVJA - Accordion - VVJC - 3D Carousel - VVJB - Basic Carousel - VVJF - 3D FlipBox - VVJH - Hero - VVJL - Lightbox - VVJP - Parallax - VVJR - Reveal - VVJS - Slideshow - VVJT - Tabs - Module Matrix - Selectify - Utilikit

If you have any questions, ideas, or feedback about my Drupal.org projects, I’d love to hear from you! To keep things open and helpful for the entire community, I encourage you to post directly in the project's issue queue on Drupal.org. This way, your questions and the answers can benefit others who may have the same needs.

At the end of the day, my goal is to make Drupal easier and more enjoyable for everyone, especially small businesses and site builders who want to create professional sites without extra hassle. Together, we can build something even better. Thank you for your support, and for being part of this journey!

Activity

Total releases
3
First release
Jan 2025
Latest release
1 week ago
Releases (12 mo)
2 ▲ from 1
Maintenance
Active

Release Timeline

Releases

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