Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 5 months ago

#52238 closed defect (bug) (fixed)

Missing option to change multiple users to "No role for this site"

Reported by: bonniebeeman Owned by: johnbillion
Priority: normal Milestone: 5.7
Component: Users Version: 3.0
Severity: normal Keywords: good-first-bug has-patch needs-testing
Cc: Focuses: administration

Description (last modified by sabernhardt)

It is often critical for the security of a WordPress site to change User roles en masse, but the option to change a user role to "No role for this site" is missing from WordPress User option dropdown list.

Attachments (3)

no role for this site - option missing.png (156.5 KB ) - added by bonniebeeman 6 years ago.
Missing option to change user role to "no role for this user"
52238.patch (1.2 KB ) - added by ovidiul 6 years ago.
Added the "— No role for this site — " to the bulk user roles change; probably the best implementation would be to add the default role None to the wp_user_roles db option, but that would have it's own complexities
52238.diff (1.4 KB ) - added by johnbillion 6 years ago.

Download all attachments as: .zip

Change History (14)

@bonniebeeman
6 years ago

Missing option to change user role to "no role for this user"

#1 @sabernhardt
6 years ago

  • Component GeneralUsers
  • Description modified (diff)
  • Keywords reporter-feedback removed
  • Milestone Awaiting Review
  • Resolutioninvalid
  • Status newclosed

Hi @bonniebeeman and welcome to Trac!

"None" or "No role for this site" must be a plugin option, as it is not one of the standard WordPress roles.

If that plugin is User Role Editor, you could request that they add it as an option to the Change role dropdown:
User Role Editor support forum

Right now with that plugin, though, you could select all Subscriber-level users and select Subscriber in the Revoke role dropdown. That changes users' role to "None" if the revoke role matches their previous role.

#2 @johnbillion
6 years ago

  • Keywords needs-patch added
  • MilestoneAwaiting Review
  • Resolution invalid
  • Status closedreopened

"No role for this site" is a core option, it's only available when editing a single user though. I don't see any reason for it not to be available as a bulk action on the Users screen.

#3 @sabernhardt
6 years ago

My mistake for not checking the Edit User screen. In addition to the bulk edit, would it be worth including this in the dropdown on the Add New User screen?

#4 @johnbillion
6 years ago

  • Keywords good-first-bug added
  • Severity criticalnormal
  • Version 5.63.0

@ovidiul
6 years ago

Added the "— No role for this site — " to the bulk user roles change; probably the best implementation would be to add the default role None to the wp_user_roles db option, but that would have it's own complexities

#5 @ovidiul
6 years ago

  • Keywords has-patch added; needs-patch removed

#6 @johnbillion
6 years ago

  • Keywords needs-testing added
  • Milestone Awaiting ReviewFuture Release

Thanks for the patch @ovidiul !

@johnbillion
6 years ago

#7 @johnbillion
6 years ago

  • Milestone Future Release5.7

52238.diff adjusts the patch slightly so the user's role gets correctly set to an empty string instead of none.

Steps to test:

  1. Visit the Users screen in the admin area
  2. Check the checkbox next to a user
  3. Select "No role for this site" in the "Change role to" dropdown
  4. Click the "Change" button
  5. Confirm the user's role is marked as "None"
  6. Confirm the user shows up when you click the "No role" filter at the top of the Users screen

This isn't something we can add an automated test for (without E2E tests) as it's tightly coupled to the request.

#8 @jeroenrotty
6 years ago

Tested the latest patch and can confirm the testing steps work as described by @johnbillion. None gets applied correctly in bulk.

#9 @johnbillion
6 years ago

  • Owner set to johnbillion
  • Resolutionfixed
  • Status reopenedclosed

In 50228:

Users: Allow the role of users to be bulk changed to no role from the Users listing screen.

This option is already available when editing an individual user, but it was previously missing from the bulk actions.

Props bonniebeeman, sabernhardt, ovidiul, jeroenrotty

Fixes #52238

#10 @johnbillion
6 years ago

In 50229:

Users: Coding standards fixes after [50228].

See #52238

#11 @deepaklalwani
5 months ago

#47593 was marked as a duplicate.

Note: See TracTickets for help on using tickets.