Login and Registration: Revert [55358] and [55360].
This reverts the changes implemented in [55358] and [55360]. Changeset [55358] was committed to prevent login name collision when one user registers with the email address `user@example.com` and a second user tries to register with the username `user@example.com`. However, it also introduced a potential backward compatibility issues for plugins that use `wp_update_user()`. When updating an existing user, it throws an `existing_user_email_as_login` error if the email address is also used for the user login, due to the code introduced in [55358]. This changeset removes the new scenario added in [55358] and [55360], restoring the `wp_insert_user()` function back to its previous state. Props polevaultweb, audrasjb, costdev, peterwilsoncc, hellofromTonya, SergeyBiryukov, azaozz. See #57967, #57394. Built from https://develop.svn.wordpress.org/trunk@55584 git-svn-id: http://core.svn.wordpress.org/trunk@55096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a0fdeb36dd
commit
1764cee3d1
|
@ -2123,16 +2123,10 @@ function wp_insert_user( $userdata ) {
|
|||
return new WP_Error( 'user_login_too_long', __( 'Username may not be longer than 60 characters.' ) );
|
||||
}
|
||||
|
||||
// Username must be unique.
|
||||
if ( ! $update && username_exists( $user_login ) ) {
|
||||
return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) );
|
||||
}
|
||||
|
||||
// Username must not match an existing user email.
|
||||
if ( email_exists( $user_login ) ) {
|
||||
return new WP_Error( 'existing_user_email_as_login', __( 'Sorry, that username is not available.' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the list of disallowed usernames.
|
||||
*
|
||||
|
@ -3346,8 +3340,6 @@ function register_new_user( $user_login, $user_email ) {
|
|||
$sanitized_user_login = '';
|
||||
} elseif ( username_exists( $sanitized_user_login ) ) {
|
||||
$errors->add( 'username_exists', __( '<strong>Error:</strong> This username is already registered. Please choose another one.' ) );
|
||||
} elseif ( email_exists( $sanitized_user_login ) ) {
|
||||
$errors->add( 'username_exists_as_email', __( '<strong>Error:</strong> This username is not available. Please choose another one.' ) );
|
||||
} else {
|
||||
/** This filter is documented in wp-includes/user.php */
|
||||
$illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55583';
|
||||
$wp_version = '6.3-alpha-55584';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue