diff --git a/src/wp-admin/includes/schema.php b/src/wp-admin/includes/schema.php index 554adb8136..0dc3df913b 100644 --- a/src/wp-admin/includes/schema.php +++ b/src/wp-admin/includes/schema.php @@ -897,13 +897,18 @@ function populate_network( $network_id = 1, $domain = '', $email = '', $site_nam if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) ) $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); - $site_user = get_user_by( 'email', $email ); if ( ! is_email( $email ) ) $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); if ( $errors->get_error_code() ) return $errors; + // If a user with the provided email does not exist, default to the current user as the new network admin. + $site_user = get_user_by( 'email', $email ); + if ( false === $site_user ) { + $site_user = wp_get_current_user(); + } + // Set up site tables. $template = get_option( 'template' ); $stylesheet = get_option( 'stylesheet' ); @@ -967,7 +972,7 @@ We hope you enjoy your new site. Thanks! $sitemeta = array( 'site_name' => $site_name, - 'admin_email' => $site_user->user_email, + 'admin_email' => $email, 'admin_user_id' => $site_user->ID, 'registration' => 'none', 'upload_filetypes' => implode( ' ', $upload_filetypes ),