Make WordPress Core


Ignore:
Timestamp:
03/23/2023 01:52:25 PM (3 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r55360 r55584  
    899899
    900900        /**
    901          * @ticket 57394
    902          */
    903         public function test_wp_insert_user_should_reject_user_login_that_matches_existing_user_email() {
    904                 $existing_email = get_option( 'admin_email' );
    905                 $user_id        = wp_insert_user(
    906                         array(
    907                                 'user_login'    => $existing_email,
    908                                 'user_email'    => 'whatever@example.com',
    909                                 'user_pass'     => 'whatever',
    910                                 'user_nicename' => 'whatever',
    911                         )
    912                 );
    913 
    914                 $this->assertWPError( $user_id );
    915                 $this->assertSame( 'existing_user_email_as_login', $user_id->get_error_code() );
    916         }
    917 
    918         /**
    919901         * @ticket 33793
    920902         */
Note: See TracChangeset for help on using the changeset viewer.