Make WordPress Core

Opened 2 months ago

Closed 6 weeks ago

#64690 closed defect (bug) (fixed)

Administration: Improve confusing error message when bulk role change skips current user

Reported by: dpknauss's profile dpknauss Owned by: audrasjb's profile audrasjb
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch needs-copy-review
Focuses: administration, ui-copy Cc:

Description

When an administrator uses Bulk Actions → Change role on the Users screen and selects
a role without the promote_users capability, the action silently skips their own
account and displays:

The current user's role must have user editing capabilities.

This is confusing for three reasons:

  1. "User editing capabilities" is internal jargon — it refers to the promote_users capability but gives no actionable information to the user.
  2. The message describes the constraint as a requirement rather than explaining what just happened and why the current user's role was not changed.
  3. There's no indication the bulk action succeeded for other users while silently skipping the current user (the second "Other user roles have been changed." notice only partially addresses this).

Proposed fix

One string change in src/wp-admin/users.php line 686:

Current: The current user's role must have user editing capabilities.
Proposed: You can't change your own role to one that doesn't allow managing

other users. Your role was not changed.

No logic changes required. The condition that sets $update = 'err_admin_role'
(lines 146–152) is correct — this is purely a copy improvement.

Steps to reproduce

  1. Log in as an Administrator.
  2. Go to Users.
  3. Select multiple users including yourself.
  4. Bulk Actions → Change role → Editor (or any role without promote_users).
  5. Observe the error message.

References
#18164 addressed the multisite super admin exemption (closed/fixed) but did not
change the message text. #43622 improved other WP Admin error messages but did
not include this one.

Attachments (2)

err_admin_role-better-message.patch (610 bytes) - added by dpknauss 2 months ago.
Patch file for ticket #64690
update.png (257.3 KB) - added by noruzzaman 8 weeks ago.
This version looks good.

Download all attachments as: .zip

Change History (9)

@dpknauss
2 months ago

Patch file for ticket #64690

#1 @audrasjb
2 months ago

  • Keywords needs-testing removed
  • Milestone changed from Awaiting Review to 7.0
  • Version trunk deleted

Thanks for the ticket, self assigning and moving to the current milestone as we can still fix that issue in 7.0 beta cycle.

#2 @audrasjb
2 months ago

  • Focuses accessibility removed

#3 @audrasjb
2 months ago

  • Owner set to audrasjb
  • Status changed from new to accepted

#4 @huzaifaalmesbah
8 weeks ago

Good catch. I agree the current message is confusing and uses internal terminology that isn’t helpful for users.
The proposed wording is much clearer and explains both what happened and why the role wasn’t changed.

@noruzzaman
8 weeks ago

This version looks good.

This ticket was mentioned in Slack in #core-test by r1k0. View the logs.


7 weeks ago

#6 @r1k0
7 weeks ago

Patch Testing Report

Patch Tested: https://core.trac.wordpress.org/attachment/ticket/64690/err_admin_role-better-message.patch

Environment

  • WordPress: 7.0-beta2-61752-src
  • PHP: 8.3.30
  • Server: nginx/1.29.5
  • Database: mysqli (Server: 8.4.8 / Client: mysqlnd 8.3.30)
  • Browser: Chrome 145.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.1
    • WordPress Importer 0.9.5

Steps taken

  1. Log in as an Administrator.
  2. Go to Users.
  3. Select multiple users, including yourself.
  4. Bulk Actions → Change role → Editor (or any role without promote_users).
  5. Observe the error message before and after applying the patch.
  6. ✅ Patch is solving the problem.

Expected result

  • The error message is now more descriptive and clearer to the user about what went wrong.

Additional Notes

  • None.

Screenshots/Screencast with results

Before:
https://i.ibb.co/1G6TNC9r/change-user-role-error-before.png

After:
https://i.ibb.co/DHnJCSgS/change-user-role-error-after.png

#7 @audrasjb
6 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 61854:

Administration: Improve the error message sent when bulk role change skips the current user.

This changeset clarifies the error message displayed when the current user tries to change their role to one that does not allow managing other users.

Props dpknauss, audrasjb, huzaifaalmesbah, noruzzaman, r1k0.
Fixes #64690.

Note: See TracTickets for help on using tickets.