WordPress.org

Make WordPress Core

Ticket #30647: 30647.diff

File 30647.diff, 881 bytes (added by rittesh.patel, 7 years ago)

Patch updated

  • wp-includes/user.php

     
    17831783         */
    17841784        $user_email = apply_filters( 'pre_user_email', $raw_user_email );
    17851785
    1786         if ( ! $update && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email ) ) {
     1786        // If there is no update just check for email_exists and if there is update, check if current email and new email are same or not and check email_exists accordingly
     1787        if ( ( ! $update || ( ! empty( $old_user_data ) && $user_email !== $old_user_data->user_email ) ) && ! defined( 'WP_IMPORTING' ) && email_exists( $user_email ) ) {
    17871788                return new WP_Error( 'existing_user_email', __( 'Sorry, that email address is already used!' ) );
    17881789        }
    17891790        $nickname = empty( $userdata['nickname'] ) ? $user_login : $userdata['nickname'];