WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/02/2010 06:00:45 PM (11 years ago)
Author:
ryan
Message:

Integrate update_profile_email() into user-edit.php. see #11644

File:
1 edited

Legend:

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

    r12842 r12928  
    6565if ( is_multisite() && !defined( "EDIT_ANY_USER" ) && !is_super_admin() && $user_id != $current_user->ID )
    6666    wp_die( __( 'You do not have permission to edit this user.' ) );
     67
     68// Execute confirmed email change. See send_confirmation_on_profile_email().
     69if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
     70    $new_email = get_option( $current_user->ID . '_new_email' );
     71    if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
     72        $user->ID = $current_user->ID;
     73        $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) );
     74        if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) )
     75            $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
     76        wp_update_user( get_object_vars( $user ) );
     77        delete_option( $current_user->ID . '_new_email' );
     78        wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) );
     79        die();
     80    }
     81}
    6782
    6883switch ($action) {
Note: See TracChangeset for help on using the changeset viewer.