Make WordPress Core

Ticket #52238: 52238.diff

File 52238.diff, 1.4 KB (added by johnbillion, 4 years ago)
  • src/wp-admin/includes/class-wp-users-list-table.php

     
    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

     
    114114                $editable_roles = get_editable_roles();
    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' => __( '&mdash; No role for this site &mdash;' ),
     120                );
     121
    117122                if ( ! $role || empty( $editable_roles[ $role ] ) ) {
    118123                        wp_die( __( 'Sorry, you are not allowed to give users that role.' ), 403 );
    119124                }
    120125
     126                if ( 'none' === $role ) {
     127                        $role = '';
     128                }
     129
    121130                $userids = $_REQUEST['users'];
    122131                $update  = 'promote';
    123132                foreach ( $userids as $id ) {