Make WordPress Core


Ignore:
Timestamp:
02/05/2021 02:38:15 PM (4 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/users.php

    r50139 r50228  
    115115        $role           = $_REQUEST['new_role'];
    116116
     117        // Mocking the `none` role so we are able to save it to the database
     118        $editable_roles['none'] = array(
     119            'name' => __( '— No role for this site —' ),
     120        );
     121
    117122        if ( ! $role || empty( $editable_roles[ $role ] ) ) {
    118123            wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
     124        }
     125
     126        if ( 'none' === $role ) {
     127            $role = '';
    119128        }
    120129
Note: See TracChangeset for help on using the changeset viewer.