Make WordPress Core

Ticket #28435: 28435.diff

File 28435.diff, 1.2 KB (added by tbcorr, 10 years ago)

.diff file for ticket 28435

  • user.php

     
    18361836 * @return int|WP_Error The updated user's ID or a WP_Error object if the user could not be updated.
    18371837 */
    18381838function wp_update_user($userdata) {
    1839         if ( is_a( $userdata, 'stdClass' ) )
     1839        if ( is_a( $userdata, 'stdClass' ) ) {
    18401840                $userdata = get_object_vars( $userdata );
    1841         elseif ( is_a( $userdata, 'WP_User' ) )
     1841        } elseif ( is_a( $userdata, 'WP_User' ) ) {
    18421842                $userdata = $userdata->to_array();
     1843        }
    18431844
    18441845        $ID = (int) $userdata['ID'];
    18451846
    18461847        // First, get all of the original fields
    18471848        $user_obj = get_userdata( $ID );
    1848         if ( ! $user_obj )
     1849        if ( ! $user_obj ) {
    18491850                return new WP_Error( 'invalid_user_id', __( 'Invalid user ID.' ) );
     1851        }
    18501852
    18511853        $user = $user_obj->to_array();
    18521854
     
    18591861        $user = add_magic_quotes( $user );
    18601862
    18611863        // If password is changing, hash it now.
    1862         if ( ! empty($userdata['user_pass']) ) {
     1864        if ( ! empty( $userdata['user_pass'] ) && $userdata['user_pass'] !== $user_obj->user_pass ) {
    18631865                $plaintext_pass = $userdata['user_pass'];
    18641866                $userdata['user_pass'] = wp_hash_password($userdata['user_pass']);
    18651867        }