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. git-svn-id: https://develop.svn.wordpress.org/trunk@40780 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
746d3c23c4
commit
31db8d6cee
@ -138,7 +138,14 @@ if ( $action ) {
|
||||
case 'promote':
|
||||
check_admin_referer( 'bulk-users' );
|
||||
$editable_roles = get_editable_roles();
|
||||
if ( empty( $editable_roles[ $_REQUEST['new_role'] ] ) ) {
|
||||
$role = false;
|
||||
if ( ! empty( $_REQUEST['new_role2'] ) ) {
|
||||
$role = $_REQUEST['new_role2'];
|
||||
} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
|
||||
$role = $_REQUEST['new_role'];
|
||||
}
|
||||
|
||||
if ( empty( $editable_roles[ $role ] ) ) {
|
||||
wp_die( __( 'Sorry, you are not allowed to give users that role.' ) );
|
||||
}
|
||||
|
||||
@ -158,7 +165,7 @@ if ( $action ) {
|
||||
}
|
||||
|
||||
$user = get_userdata( $user_id );
|
||||
$user->set_role( $_REQUEST['new_role'] );
|
||||
$user->set_role( $role );
|
||||
}
|
||||
} else {
|
||||
$update = 'err_promote';
|
||||
|
Loading…
Reference in New Issue
Block a user