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: http://svn.automattic.com/wordpress/trunk@13961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-03 08:08:12 +00:00
parent 65d12646e1
commit 927a8afbf3
2 changed files with 3 additions and 3 deletions

View File

@ -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.'));
}

View File

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