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.

Built from https://develop.svn.wordpress.org/trunk@40780


git-svn-id: http://core.svn.wordpress.org/trunk@40638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2017-05-18 17:08:43 +00:00
parent 591f423132
commit fd63ede892
2 changed files with 10 additions and 3 deletions

View File

@ -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';

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.8-beta1-40779';
$wp_version = '4.8-beta1-40780';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.