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.


git-svn-id: https://develop.svn.wordpress.org/trunk@55584 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2023-03-23 13:52:25 +00:00
parent 77883f97fc
commit dfc078d19d
2 changed files with 0 additions and 26 deletions

View File

@@ -897,24 +897,6 @@ class Tests_User extends WP_UnitTestCase {
$this->assertSame( 'user_login_too_long', $u->get_error_code() );
}
/**
* @ticket 57394
*/
public function test_wp_insert_user_should_reject_user_login_that_matches_existing_user_email() {
$existing_email = get_option( 'admin_email' );
$user_id = wp_insert_user(
array(
'user_login' => $existing_email,
'user_email' => 'whatever@example.com',
'user_pass' => 'whatever',
'user_nicename' => 'whatever',
)
);
$this->assertWPError( $user_id );
$this->assertSame( 'existing_user_email_as_login', $user_id->get_error_code() );
}
/**
* @ticket 33793
*/