Add filter option to UserSelection to exclude blocked users

Created on 3 February 2017, almost 8 years ago
Updated 28 May 2024, 7 months ago

Problem/Motivation

The UserSelection entity reference handler currently excludes blocked users only for people without the administer users permission. For many user reference fields, it would be nice to exclude them for all users, similar to how the anonymous user can be excluded.

Proposed resolution

Add the option to do this.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Needs work

Version

11.0 🔥

Component
User module 

Last updated about 3 hours ago

Created by

🇺🇸United States jhedstrom Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
  • Status changed to Closed: outdated 4 months ago
  • 🇨🇦Canada blanca.esqueda

    The patch don't apply to Core 10.3.1
    The patch in comment #20 is already included in Core 10: https://api.drupal.org/api/drupal/core%21modules%21user%21src%21Plugin%2...

  • 🇺🇸United States Steven Spasbo Oakland, CA

    Rerolled patch for 10.3.2

  • 🇮🇹Italy kopeboy Milan

    The fix had not been included in core yet!

    I applied the rerolled patch in #39, which still applies cleanly even to Drupal 10.3.6, and it worked fine, it just needs some clarification in the field help text imo..

    When creating Entity reference fields on Users, this becomes the default:

    You would assume from the description that the checked option will make users without the 'administer users' permission able to select blocked users. The opposite is true: the checked option, ie. by default, leaves core behaving like currently (you can't select blocked users unless you have the 'admin users' perm), but if unchecked it hides the blocked users on that field even to roles with the 'aminister users' permission.

    So the feature is consistent with the original request, but we can improve the intuitiveness by reverting the label & description:

    [ ] Exclude blocked users (unchecked by default - also, leave the "Include the anonymous user." as independent of this option)
    Even if this option is not set, only users with the administer users permission may (view and) reference blocked users.

  • Status changed to Needs work 21 days ago
  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.

Production build 0.71.5 2024