Make WordPress Core

Ticket #44347: 44347.wp-includes.user.php.diff

File 44347.wp-includes.user.php.diff, 1.2 KB (added by subrataemfluence, 4 years ago)

File path: /wp-includes/user.php

  • user.php

    diff --git src/wp-includes/user.php b/user.php
    index 566702f..4a530b1 100755
    old new function register_new_user( $user_login, $user_email ) { 
    24392439        }
    24402440
    24412441        /**
     2442         * Additional checks for cross-referenced email and username among existing accounts.
     2443         * Prevent using existing email address as username and vice versa.
     2444         * Do not allow an existing email address to be used as a username of the new account.
     2445         * Do not allow an existing username to be used as the email address of the new account.
     2446         */
     2447       
     2448        // Check if username is being used as the email address of another account.
     2449        if ( email_exists( $sanitized_user_login ) ) {
     2450                $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This username is invalid because it is already the email address of another account.' ) );
     2451        }
     2452
     2453        // Check if email address is being used as the username of another account.
     2454        if ( '' !== $user_email && username_exists( $user_email ) ) {
     2455                $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This email address cannot be used because it is already the username of another account.' ) );
     2456        }
     2457
     2458        /**
    24422459         * Fires when submitting registration form data, before the user is created.
    24432460         *
    24442461         * @since 2.1.0