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 Built from https://develop.svn.wordpress.org/trunk@50228 git-svn-id: http://core.svn.wordpress.org/trunk@49889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d28712518c
commit
523e292d8c
|
@ -300,6 +300,7 @@ class WP_Users_List_Table extends WP_List_Table {
|
|||
<select name="<?php echo $id; ?>" id="<?php echo $id; ?>">
|
||||
<option value=""><?php _e( 'Change role to…' ); ?></option>
|
||||
<?php wp_dropdown_roles(); ?>
|
||||
<option value="none"><?php echo __( '— No role for this site —' ) ?> </option>
|
||||
</select>
|
||||
<?php
|
||||
submit_button( __( 'Change' ), '', $button_id, false );
|
||||
|
|
|
@ -114,10 +114,19 @@ switch ( $wp_list_table->current_action() ) {
|
|||
$editable_roles = get_editable_roles();
|
||||
$role = $_REQUEST['new_role'];
|
||||
|
||||
// Mocking the `none` role so we are able to save it to the database
|
||||
$editable_roles['none'] = array(
|
||||
'name' => __( '— No role for this site —' ),
|
||||
);
|
||||
|
||||
if ( ! $role || empty( $editable_roles[ $role ] ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
|
||||
}
|
||||
|
||||
if ( 'none' === $role ) {
|
||||
$role = '';
|
||||
}
|
||||
|
||||
$userids = $_REQUEST['users'];
|
||||
$update = 'promote';
|
||||
foreach ( $userids as $id ) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.7-beta1-50192';
|
||||
$wp_version = '5.7-beta1-50228';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue