mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-05 05:04:31 +00:00
Multisite: Switch to a usermeta key for email confirmation.
To prevent inconsistent data across sites in a network the new email address is now stored in usermeta. Adds visual feedback for the case when an update has failed. All existing options will be removed on a database upgrade. Props MikeHansenMe, kovshenin, jeremyfelt, ocean90. Fixes #23358. git-svn-id: https://develop.svn.wordpress.org/trunk@36679 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -342,16 +342,16 @@ function send_confirmation_on_profile_email() {
|
||||
|
||||
if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
|
||||
$errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address is already used." ), array( 'form-field' => 'email' ) );
|
||||
delete_option( $current_user->ID . '_new_email' );
|
||||
delete_user_meta( $current_user->ID, '_new_email' );
|
||||
return;
|
||||
}
|
||||
|
||||
$hash = md5( $_POST['email'] . time() . mt_rand() );
|
||||
$new_user_email = array(
|
||||
'hash' => $hash,
|
||||
'newemail' => $_POST['email']
|
||||
);
|
||||
update_option( $current_user->ID . '_new_email', $new_user_email );
|
||||
'hash' => $hash,
|
||||
'newemail' => $_POST['email']
|
||||
);
|
||||
update_user_meta( $current_user->ID, '_new_email', $new_user_email );
|
||||
|
||||
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
|
||||
$email_text = __( 'Howdy ###USERNAME###,
|
||||
@@ -408,9 +408,9 @@ All at ###SITENAME###
|
||||
*/
|
||||
function new_user_email_admin_notice() {
|
||||
global $pagenow;
|
||||
if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) && $email = get_option( get_current_user_id() . '_new_email' ) ) {
|
||||
if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) && $email = get_user_meta( get_current_user_id(), '_new_email', true ) ) {
|
||||
/* translators: %s: New email address */
|
||||
echo '<div class="update-nag">' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), esc_html( $email['newemail'] ) ) . '</div>';
|
||||
echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user