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. Built from https://develop.svn.wordpress.org/trunk@35575 git-svn-id: http://core.svn.wordpress.org/trunk@35539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9fb7dcc30d
commit
23c1050fb9
|
@ -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 ),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-beta3-35574';
|
||||
$wp_version = '4.4-beta3-35575';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue