WordPress.org

Make WordPress Core

Changeset 35575


Ignore:
Timestamp:
11/08/15 03:15:07 (18 months ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/schema.php

    r35507 r35575  
    898898        $errors->add( 'siteid_exists', __( 'The network already exists.' ) ); 
    899899 
    900     $site_user = get_user_by( 'email', $email ); 
    901900    if ( ! is_email( $email ) ) 
    902901        $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) ); 
     
    904903    if ( $errors->get_error_code() ) 
    905904        return $errors; 
     905 
     906    // If a user with the provided email does not exist, default to the current user as the new network admin. 
     907    $site_user = get_user_by( 'email', $email ); 
     908    if ( false === $site_user ) { 
     909        $site_user = wp_get_current_user(); 
     910    } 
    906911 
    907912    // Set up site tables. 
     
    968973    $sitemeta = array( 
    969974        'site_name' => $site_name, 
    970         'admin_email' => $site_user->user_email, 
     975        'admin_email' => $email, 
    971976        'admin_user_id' => $site_user->ID, 
    972977        'registration' => 'none', 
Note: See TracChangeset for help on using the changeset viewer.