Ticket #23358: 23358.5.diff
File 23358.5.diff, 5.1 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/ms.php
342 342 343 343 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) { 344 344 $errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address is already used." ), array( 'form-field' => 'email' ) ); 345 delete_ option( $current_user->ID .'_new_email' );345 delete_user_meta( $current_user->ID, '_new_email' ); 346 346 return; 347 347 } 348 348 … … 351 351 'hash' => $hash, 352 352 'newemail' => $_POST['email'] 353 353 ); 354 update_ option( $current_user->ID .'_new_email', $new_user_email );354 update_user_meta( $current_user->ID, '_new_email', $new_user_email ); 355 355 356 356 /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ 357 357 $email_text = __( 'Howdy ###USERNAME###, -
src/wp-admin/includes/upgrade.php
1668 1668 * @ignore 1669 1669 * @since 4.5.0 1670 1670 * 1671 * @global int $wp_current_db_version 1671 * @global int $wp_current_db_version 1672 * @global wpdb $wpdb 1672 1673 */ 1673 1674 function upgrade_450() { 1674 global $wp_current_db_version; 1675 if ( $wp_current_db_version < 36180 ) 1675 global $wp_current_db_version, $wpdb; 1676 1677 if ( $wp_current_db_version < 36180 ) { 1676 1678 wp_clear_scheduled_hook( 'wp_maybe_auto_update' ); 1679 } 1680 1681 // Remove unused email change options, moved to user meta. 1682 if ( $wp_current_db_version < 36584 && is_multisite() ) { 1683 $wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '[0-9]+_new_email'" ); 1684 } 1677 1685 } 1678 1686 1679 1687 /** -
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');86 if ( $new_email [ 'hash' ] == $_GET[ 'newuseremail' ] ) {85 $new_email = get_user_meta( $current_user->ID . '_new_email', true ); 86 if ( $new_email && $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) { 87 87 $user = new stdClass; 88 88 $user->ID = $current_user->ID; 89 89 $user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) ); 90 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) 90 if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) { 91 91 $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) ); 92 } 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(); 97 } else { 98 wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) ); 96 99 } 97 100 } elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) { 98 delete_ option( $current_user->ID .'_new_email' );101 delete_user_meta( $current_user->ID, '_new_email' ); 99 102 wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) ); 100 103 die(); 101 104 } … … 181 184 <?php endif; ?> 182 185 </div> 183 186 <?php endif; ?> 187 <?php if ( isset( $_GET['error'] ) ) : ?> 188 <div id="message" class="notice notice-error"> 189 <?php if ( 'new-email' == $_GET['error'] ) : ?> 190 <p><?php _e( 'Error while saving the new email. Please try again.' ); ?></p> 191 <?php endif; ?> 192 </div> 193 <?php endif; ?> 184 194 <?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?> 185 195 <div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div> 186 196 <?php endif; ?> … … 383 393 <th><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> 384 394 <td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" /> 385 395 <?php 386 $new_email = get_ option( $current_user->ID . '_new_email');396 $new_email = get_user_meta( $current_user->ID . '_new_email', true ); 387 397 if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?> 388 398 <div class="updated inline"> 389 399 <p><?php -
src/wp-includes/version.php
11 11 * 12 12 * @global int $wp_db_version 13 13 */ 14 $wp_db_version = 36 180;14 $wp_db_version = 36584; 15 15 16 16 /** 17 17 * Holds the TinyMCE version