WordPress.org

Make WordPress Core

Ticket #18934: 18934.2.diff

File 18934.2.diff, 1.6 KB (added by PeteMall, 3 years ago)
  • wp-admin/user-edit.php

     
    117117        if ( $user->user_login && isset( $_POST[ 'email' ] ) && is_email( $_POST[ 'email' ] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) 
    118118                $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) ); 
    119119 
    120         // WPMU must delete the user from the current blog if WP added him after editing. 
    121         $delete_role = false; 
    122         $blog_prefix = $wpdb->get_blog_prefix(); 
    123         if ( $user_id != $current_user->ID ) { 
    124                 $cap = $wpdb->get_var( "SELECT meta_value FROM {$wpdb->usermeta} WHERE user_id = '{$user_id}' AND meta_key = '{$blog_prefix}capabilities' AND meta_value = 'a:0:{}'" ); 
    125                 if ( !is_network_admin() && null == $cap && $_POST[ 'role' ] == '' ) { 
    126                         $_POST[ 'role' ] = 'contributor'; 
    127                         $delete_role = true; 
    128                 } 
    129         } 
    130120        if ( !isset( $errors ) || ( isset( $errors ) && is_object( $errors ) && false == $errors->get_error_codes() ) ) 
    131121                $errors = edit_user($user_id); 
    132         if ( $delete_role ) // stops users being added to current blog when they are edited 
    133                 delete_user_meta( $user_id, $blog_prefix . 'capabilities' ); 
    134122 
    135123        if ( is_multisite() && is_network_admin() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) 
    136124                empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );