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.
Built from https://develop.svn.wordpress.org/trunk@52074


git-svn-id: http://core.svn.wordpress.org/trunk@51666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2021-11-09 15:28:59 +00:00
parent e47027ff1f
commit 0fd9ad6c2f
3 changed files with 17 additions and 3 deletions

View File

@ -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?

View File

@ -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()
)
);
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-52073';
$wp_version = '5.9-alpha-52074';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.