Make WordPress Core


Ignore:
Timestamp:
05/18/2017 05:07:23 PM (7 years ago)
Author:
jeremyfelt
Message:

Multisite: Handle both role change selections in site-users.php.

Previously, a role selected below the list table would not apply on save. This aligns the behavior with wp-admin/users.php and allows role changes from both selections, deferring to the bottom selection when both are populated.

Props desrosj.
Fixes #40113.

File:
1 edited

Legend:

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

    r38957 r40780  
    139139            check_admin_referer( 'bulk-users' );
    140140            $editable_roles = get_editable_roles();
    141             if ( empty( $editable_roles[ $_REQUEST['new_role'] ] ) ) {
     141            $role = false;
     142            if ( ! empty( $_REQUEST['new_role2'] ) ) {
     143                $role = $_REQUEST['new_role2'];
     144            } elseif ( ! empty( $_REQUEST['new_role'] ) ) {
     145                $role = $_REQUEST['new_role'];
     146            }
     147
     148            if ( empty( $editable_roles[ $role ] ) ) {
    142149                wp_die( __( 'Sorry, you are not allowed to give users that role.' ) );
    143150            }
     
    159166
    160167                    $user = get_userdata( $user_id );
    161                     $user->set_role( $_REQUEST['new_role'] );
     168                    $user->set_role( $role );
    162169                }
    163170            } else {
Note: See TracChangeset for help on using the changeset viewer.