WordPress.org

Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r14608 r15452  
    2222function add_user() {
    2323    if ( func_num_args() ) { // The hackiest hack that ever did hack
    24         global $current_user, $wp_roles;
     24        global $wp_roles;
    2525        $user_id = (int) func_get_arg( 0 );
    2626
     
    2828            $new_role = sanitize_text_field( $_POST['role'] );
    2929            // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
    30             if ( $user_id != $current_user->id || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
     30            if ( $user_id != get_current_user_id() || $wp_roles->role_objects[$new_role]->has_cap( 'edit_users' ) ) {
    3131                // If the new role isn't editable by the logged-in user die with error
    3232                $editable_roles = get_editable_roles();
     
    5555 */
    5656function edit_user( $user_id = 0 ) {
    57     global $current_user, $wp_roles, $wpdb;
     57    global $wp_roles, $wpdb;
    5858    if ( $user_id != 0 ) {
    5959        $update = true;
     
    8080        // Don't let anyone with 'edit_users' (admins) edit their own role to something without it.
    8181        // Multisite super admins can freely edit their blog roles -- they possess all caps.
    82         if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != $current_user->id || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
     82        if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) )
    8383            $user->role = $new_role;
    8484
Note: See TracChangeset for help on using the changeset viewer.