MS: Show an error if a new site slug conflicts with an existing username.

Props utkarshpatel, dipesh.kakadiya.
Fixes #33804.

Built from https://develop.svn.wordpress.org/trunk@34996


git-svn-id: http://core.svn.wordpress.org/trunk@34961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2015-10-10 01:42:26 +00:00
parent 1b1e18027d
commit f8a05879e8
2 changed files with 5 additions and 1 deletions

View File

@ -90,6 +90,10 @@ if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) {
$password = 'N/A'; $password = 'N/A';
$user_id = email_exists($email); $user_id = email_exists($email);
if ( !$user_id ) { // Create a new user with a random password if ( !$user_id ) { // Create a new user with a random password
$user_id = username_exists( $domain );
if ( $user_id ) {
wp_die( __( 'The domain or path entered conflicts with an existing username.' ) );
}
$password = wp_generate_password( 12, false ); $password = wp_generate_password( 12, false );
$user_id = wpmu_create_user( $domain, $password, $email ); $user_id = wpmu_create_user( $domain, $password, $email );
if ( false === $user_id ) { if ( false === $user_id ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34995'; $wp_version = '4.4-alpha-34996';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.