From 4a6df3f37db2344d61b190668eb417e4b606834a Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Tue, 9 Nov 2021 15:27:58 +0000 Subject: [PATCH] Login and Registration: Improve "email already exists" registration error message. Adds the `wp_login_url()` login link to the Error message to be more helpful to users when their user email already is registered. Improves the error message to more clearly communicate next step. Follow-up to [16009], [22124], [31963]. Props andynick, costdev, dansoschin, sabernhardt, webcommsat. Fixes #53631. git-svn-id: https://develop.svn.wordpress.org/trunk@52074 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/ms-functions.php | 9 ++++++++- src/wp-includes/user.php | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 09b48be38a..ec461328f7 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -538,7 +538,14 @@ function wpmu_validate_user_signup( $user_name, $user_email ) { // Check if the email address has been used already. if ( email_exists( $user_email ) ) { - $errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) ); + $errors->add( + 'user_email', + sprintf( + /* translators: %s: Link to the login page. */ + __( 'Error: This email address is already registered. Log in with this address or choose another one.' ), + wp_login_url() + ) + ); } // Has someone already signed up for this username? diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 49f4f3fa7d..b5a4a3467a 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -3110,7 +3110,14 @@ function register_new_user( $user_login, $user_email ) { $errors->add( 'invalid_email', __( 'Error: The email address isn’t correct.' ) ); $user_email = ''; } elseif ( email_exists( $user_email ) ) { - $errors->add( 'email_exists', __( 'Error: This email is already registered. Please choose another one.' ) ); + $errors->add( + 'email_exists', + sprintf( + /* translators: %s: Link to the login page. */ + __( 'Error: This email address is already registered. Log in with this address or choose another one.' ), + wp_login_url() + ) + ); } /**