WordPress.org

Make WordPress Core

Changeset 12928


Ignore:
Timestamp:
02/02/10 18:00:45 (4 years ago)
Author:
ryan
Message:

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

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r12920 r12928  
    267267add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2); 
    268268 
    269 function update_profile_email() { 
    270     global $current_user, $wpdb; 
    271     if ( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { 
    272         $new_email = get_option( $current_user->ID . '_new_email' ); 
    273         if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { 
    274             $user->ID = $current_user->ID; 
    275             $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) ); 
    276             if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) 
    277                 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); 
    278             wp_update_user( get_object_vars( $user ) ); 
    279             delete_option( $current_user->ID . '_new_email' ); 
    280             wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) ); 
    281             die(); 
    282         } 
    283     } 
    284 } 
    285  
    286269function send_confirmation_on_profile_email() { 
    287270    global $errors, $wpdb, $current_user, $current_site; 
     
    804787} 
    805788 
    806 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) ) { 
    807     add_action( 'admin_init', 'update_profile_email' ); 
    808 } 
    809  
    810789function stripslashes_from_options( $blog_id ) { 
    811790    global $wpdb; 
  • 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.