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 .

git-svn-id: https://develop.svn.wordpress.org/trunk@52074 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2021-11-09 15:27:58 +00:00
parent 2e911f4f16
commit 4a6df3f37d
2 changed files with 16 additions and 2 deletions

@ -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. */
__( '<strong>Error:</strong> This email address is already registered. <a href="%s">Log in</a> with this address or choose another one.' ),
wp_login_url()
)
);
}
// Has someone already signed up for this username?

@ -3110,7 +3110,14 @@ function register_new_user( $user_login, $user_email ) {
$errors->add( 'invalid_email', __( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
$user_email = '';
} elseif ( email_exists( $user_email ) ) {
$errors->add( 'email_exists', __( '<strong>Error</strong>: This email is already registered. Please choose another one.' ) );
$errors->add(
'email_exists',
sprintf(
/* translators: %s: Link to the login page. */
__( '<strong>Error:</strong> This email address is already registered. <a href="%s">Log in</a> with this address or choose another one.' ),
wp_login_url()
)
);
}
/**