WordPress.org

Make WordPress Core

Ticket #33804: 33804.diff

File 33804.diff, 650 bytes (added by utkarshpatel, 6 years ago)

Added check for username exist

  • wp-admin/network/site-new.php

    diff --git wp-admin/network/site-new.php wp-admin/network/site-new.php
    index 5876037..5143874 100644
    if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { 
    8888
    8989        $password = 'N/A';
    9090        $user_id = email_exists($email);
    91         if ( !$user_id ) { // Create a new user with a random password
     91        $user_name_id = username_exists($email);
     92        if ( !$user_id && !$user_name_id ) { // Create a new user with a random password
    9293                $password = wp_generate_password( 12, false );
    9394                $user_id = wpmu_create_user( $domain, $password, $email );
    9495                if ( false === $user_id )