From 10dd8c858fb471ef4ba245c364031cec92b6f2d2 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 2 Feb 2010 18:00:45 +0000 Subject: [PATCH] Integrate update_profile_email() into user-edit.php. see #11644 git-svn-id: https://develop.svn.wordpress.org/trunk@12928 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ms.php | 21 --------------------- wp-admin/user-edit.php | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index 4ed3d9d85f..cff25701d8 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -266,23 +266,6 @@ All at ###SITENAME### } add_action('update_option_new_admin_email', 'update_option_new_admin_email', 10, 2); -function update_profile_email() { - global $current_user, $wpdb; - if ( isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { - $new_email = get_option( $current_user->ID . '_new_email' ); - if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { - $user->ID = $current_user->ID; - $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) ); - if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) - $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); - wp_update_user( get_object_vars( $user ) ); - delete_option( $current_user->ID . '_new_email' ); - wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) ); - die(); - } - } -} - function send_confirmation_on_profile_email() { global $errors, $wpdb, $current_user, $current_site; if ( ! is_object($errors) ) @@ -803,10 +786,6 @@ function choose_primary_blog() { ID ) wp_die( __( 'You do not have permission to edit this user.' ) ); +// Execute confirmed email change. See send_confirmation_on_profile_email(). +if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { + $new_email = get_option( $current_user->ID . '_new_email' ); + if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { + $user->ID = $current_user->ID; + $user->user_email = wp_specialchars( trim( $new_email[ 'newemail' ] ) ); + if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); + wp_update_user( get_object_vars( $user ) ); + delete_option( $current_user->ID . '_new_email' ); + wp_redirect( add_query_arg( array('updated' => 'true'), admin_url( 'profile.php' ) ) ); + die(); + } +} + switch ($action) { case 'switchposts':