WordPress.org

Make WordPress Core

Changeset 13463


Ignore:
Timestamp:
02/27/2010 06:07:25 PM (8 years ago)
Author:
wpmuguru
Message:

warnings cleanup edit user, props dd32, see #12387

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/user.php

    r13377 r13463  
    7777    if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) {
    7878        $new_role = sanitize_text_field( $_POST['role'] );
     79        $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false;
    7980        // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
    80         if( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ))
     81        if ( $user_id != $current_user->id || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
    8182            $user->role = $new_role;
    8283
Note: See TracChangeset for help on using the changeset viewer.