MS: Allow "Network Admin Email" to be a non-user during network setup.

The network admin email setting for a network is often used as a catch-all or notification email separate from the actual user ID set as the owner of the new network. If a non-user email address is set during network installation, we can defer to the current user as the actual network admin and apply the entered email as the address to which general notifications are sent and emails are sent from.

In the future, we'll want to update the messaging around "Network Admin Email" to reflect its reality. See #34293.

Props jjeaton.
Fixes #34065.


git-svn-id: https://develop.svn.wordpress.org/trunk@35575 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt 2015-11-08 03:15:07 +00:00
parent 71d22131e6
commit 21de649fd0
1 changed files with 7 additions and 2 deletions

View File

@ -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 ),