Make WordPress Core

Ticket #45746: 45746.diff

File 45746.diff, 1.3 KB (added by jayswadas, 6 years ago)
  • src/wp-includes/user.php

     
    21872187 *
    21882188 * @since 4.4.0
    21892189 *
    2190  * @global wpdb         $wpdb      WordPress database abstraction object.
    21912190 * @global PasswordHash $wp_hasher Portable PHP password hashing framework.
    21922191 *
    21932192 * @param WP_User $user User to retrieve password reset key for.
     
    21952194 * @return string|WP_Error Password reset key on success. WP_Error on error.
    21962195 */
    21972196function get_password_reset_key( $user ) {
    2198         global $wpdb, $wp_hasher;
     2197        global $wp_hasher;
    21992198
    22002199        /**
    22012200         * Fires before a new password is retrieved.
     
    22582257                $wp_hasher = new PasswordHash( 8, true );
    22592258        }
    22602259        $hashed    = time() . ':' . $wp_hasher->HashPassword( $key );
    2261         $key_saved = $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
     2260        $key_saved = wp_update_user( array( 'ID' => $user->ID, 'user_activation_key' => $hashed, 'user_login' => $user->user_login ) );
     2261        clean_user_cache( $user->ID );
    22622262        if ( false === $key_saved ) {
    22632263                return new WP_Error( 'no_password_key_update', __( 'Could not save password reset key to database.' ) );
    22642264        }