Make WordPress Core


Ignore:
Timestamp:
03/23/2023 02:17:39 PM (19 months 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.
Reviewed by hellofromTonya.
Merges [55584] to the 6.2 branch.
See #57967, #57394.

Location:
branches/6.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.2

  • branches/6.2/src/wp-includes/user.php

    r55414 r55585  
    21242124    }
    21252125
    2126     // Username must be unique.
    21272126    if ( ! $update && username_exists( $user_login ) ) {
    21282127        return new WP_Error( 'existing_user_login', __( 'Sorry, that username already exists!' ) );
    2129     }
    2130 
    2131     // Username must not match an existing user email.
    2132     if ( email_exists( $user_login ) ) {
    2133         return new WP_Error( 'existing_user_email_as_login', __( 'Sorry, that username is not available.' ) );
    21342128    }
    21352129
     
    33473341    } elseif ( username_exists( $sanitized_user_login ) ) {
    33483342        $errors->add( 'username_exists', __( '<strong>Error:</strong> This username is already registered. Please choose another one.' ) );
    3349     } elseif ( email_exists( $sanitized_user_login ) ) {
    3350         $errors->add( 'username_exists_as_email', __( '<strong>Error:</strong> This username is not available. Please choose another one.' ) );
    33513343    } else {
    33523344        /** This filter is documented in wp-includes/user.php */
Note: See TracChangeset for help on using the changeset viewer.