Ticket #23358: 23358.4.diff
File 23358.4.diff, 4.8 KB (added by , 8 years ago) |
---|
-
src/wp-admin/includes/ms.php
329 329 if ( $current_user->ID != $_POST['user_id'] ) 330 330 return false; 331 331 332 _user_new_email_compat( $current_user->ID ); 333 332 334 if ( $current_user->user_email != $_POST['email'] ) { 333 335 if ( !is_email( $_POST['email'] ) ) { 334 336 $errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address isn’t correct." ), array( 'form-field' => 'email' ) ); … … 337 339 338 340 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) { 339 341 $errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address is already used." ), array( 'form-field' => 'email' ) ); 340 delete_ option( $current_user->ID .'_new_email' );342 delete_user_meta( $current_user->ID, '_new_email' ); 341 343 return; 342 344 } 343 345 … … 400 402 * @since 3.0.0 401 403 */ 402 404 function new_user_email_admin_notice() { 403 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) ) 404 echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>"; 405 if ( strpos( $_SERVER['PHP_SELF'], 'profile.php' ) && isset( $_GET['updated'] ) ) { 406 _user_new_email_compat( get_current_user_id() ); 407 if ( $email = get_user_meta( get_current_user_id(), '_new_email', true ) ) 408 echo "<div class='update-nag'>" . sprintf( __( "Your email address has not been updated yet. Please check your inbox at %s for a confirmation email." ), $email['newemail'] ) . "</div>"; 409 } 405 410 } 406 411 407 412 /** -
src/wp-admin/includes/user.php
516 516 Please click the following link to activate your user account: 517 517 %%s' ), get_bloginfo( 'name' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) ); 518 518 } 519 520 /** 521 * Pending e-mail changes used to be stored in options. This helps transition to user meta. 522 * 523 * @access private 524 * @since 3.7.0 525 */ 526 function _user_new_email_compat( $user_id ) { 527 if ( get_option( $user_id . '_new_email', false ) ) { 528 update_user_meta( $user_id, '_new_email', get_option( $user_id . '_new_email' ) ); 529 delete_option( $user_id . '_new_email' ); 530 } 531 } 532 No newline at end of file -
src/wp-admin/user-edit.php
82 82 83 83 // Execute confirmed email change. See send_confirmation_on_profile_email(). 84 84 if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) { 85 $new_email = get_option( $current_user->ID . '_new_email' ); 85 _user_new_email_compat( $current_user->ID ); 86 $new_email = get_user_meta( $current_user->ID, '_new_email', true ); 86 87 if ( $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { 87 88 $user = new stdClass; 88 89 $user->ID = $current_user->ID; … … 90 91 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) 91 92 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); 92 93 wp_update_user( $user ); 93 delete_ option( $current_user->ID .'_new_email' );94 delete_user_meta( $current_user->ID, '_new_email' ); 94 95 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); 95 96 die(); 96 97 } 97 98 } elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) { 98 delete_option( $current_user->ID . '_new_email' ); 99 _user_new_email_compat( $current_user->ID ); 100 delete_user_meta( $current_user->ID, '_new_email' ); 99 101 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); 100 102 die(); 101 103 } … … 383 385 <th><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> 384 386 <td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" /> 385 387 <?php 386 $new_email = get_option( $current_user->ID . '_new_email' ); 388 _user_new_email_compat( $current_user->ID ); 389 $new_email = get_user_meta( $current_user->ID, '_new_email', true ); 387 390 if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?> 388 391 <div class="updated inline"> 389 392 <p><?php