From b4ae4c89e94658f60574b95d936d858464f2523f Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 3 Apr 2010 08:08:12 +0000 Subject: [PATCH] Allow "No role for this blog" to be chosen on user-edit. Add defensive checks for a few potential notices. fixes #10833 git-svn-id: https://develop.svn.wordpress.org/trunk@13961 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/user.php | 4 ++-- wp-admin/users.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 6a4478c3ae..379dcd4fdb 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -30,7 +30,7 @@ function add_user() { if ( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) { // If the new role isn't editable by the logged-in user die with error $editable_roles = get_editable_roles(); - if ( !$editable_roles[$new_role] ) + if ( empty( $editable_roles[$new_role] ) ) wp_die(__('You can’t give users that role.')); $user = new WP_User( $user_id ); @@ -84,7 +84,7 @@ function edit_user( $user_id = 0 ) { // If the new role isn't editable by the logged-in user die with error $editable_roles = get_editable_roles(); - if ( !$editable_roles[$new_role] ) + if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) wp_die(__('You can’t give users that role.')); } diff --git a/wp-admin/users.php b/wp-admin/users.php index fb7e24f120..1c491d03ac 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -57,7 +57,7 @@ case 'promote': } $editable_roles = get_editable_roles(); - if ( !$editable_roles[$_REQUEST['new_role']] ) + if ( empty( $editable_roles[$_REQUEST['new_role']] ) ) wp_die(__('You can’t give users that role.')); $userids = $_REQUEST['users'];