From fd63ede892d660e1bb45c0d883f68b95801492b4 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Thu, 18 May 2017 17:08:43 +0000 Subject: [PATCH] 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 --- wp-admin/network/site-users.php | 11 +++++++++-- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/wp-admin/network/site-users.php b/wp-admin/network/site-users.php index fcd1a863d0..eb96158c08 100644 --- a/wp-admin/network/site-users.php +++ b/wp-admin/network/site-users.php @@ -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'; diff --git a/wp-includes/version.php b/wp-includes/version.php index 65193c4ed5..11a38e4384 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.