Make WordPress Core

Ticket #52238: 52238.patch

File 52238.patch, 1.2 KB (added by ovidiul, 3 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

  • src/wp-admin/includes/class-wp-users-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-users-list-table.php b/src/wp-admin/includes/class-wp-users-list-table.php
    index 7e1e79f500..c08338364e 100644
    a b class WP_Users_List_Table extends WP_List_Table { 
    295295                <select name="<?php echo $id; ?>" id="<?php echo $id; ?>">
    296296                        <option value=""><?php _e( 'Change role to&hellip;' ); ?></option>
    297297                        <?php wp_dropdown_roles(); ?>
     298                        <option value="none"><?php echo __( '&mdash; No role for this site &mdash;' ) ?> </option>
    298299                </select>
    299300                        <?php
    300301                        submit_button( __( 'Change' ), '', $button_id, false );
  • src/wp-admin/users.php

    diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php
    index e8f006b9f4..bf214c865c 100644
    a b switch ( $wp_list_table->current_action() ) { 
    112112                }
    113113
    114114                $editable_roles = get_editable_roles();
     115               
     116                //mocking `none` role so we are able to save it to the database
     117                $editable_roles['none'] = array( "name" => __( '&mdash; No role for this site &mdash;' ) );
     118
    115119                $role           = $_REQUEST['new_role'];
    116120
    117121                if ( ! $role || empty( $editable_roles[ $role ] ) ) {