WordPress.org

Make WordPress Core

Ticket #34065: 34065.2.diff

File 34065.2.diff, 1.8 KB (added by jjeaton, 4 years ago)

refreshed to use submitted email as admin_email

  • src/wp-admin/includes/network.php

     
    278278                                <td>
    279279                                        <input name='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' />
    280280                                        <p class="description">
    281                                                 <?php _e( 'Your email address.' ); ?>
     281                                                <?php _e( 'This address is used for admin purposes, like site notifications. Registration emails will be sent from this address.' ); ?>
    282282                                        </p>
    283283                                </td>
    284284                        </tr>
  • src/wp-admin/includes/schema.php

     
    900900        if ( $network_id == $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE id = %d", $network_id ) ) )
    901901                $errors->add( 'siteid_exists', __( 'The network already exists.' ) );
    902902
    903         $site_user = get_user_by( 'email', $email );
    904903        if ( ! is_email( $email ) )
    905904                $errors->add( 'invalid_email', __( 'You must provide a valid email address.' ) );
    906905
     
    907906        if ( $errors->get_error_code() )
    908907                return $errors;
    909908
     909        // Attempt to get a user with the provided email, default to the current user.
     910        $site_user = get_user_by( 'email', $email );
     911        if ( false === $site_user ) {
     912                $site_user = wp_get_current_user();
     913        }
     914
    910915        // Set up site tables.
    911916        $template = get_option( 'template' );
    912917        $stylesheet = get_option( 'stylesheet' );
     
    970975
    971976        $sitemeta = array(
    972977                'site_name' => $site_name,
    973                 'admin_email' => $site_user->user_email,
     978                'admin_email' => $email,
    974979                'admin_user_id' => $site_user->ID,
    975980                'registration' => 'none',
    976981                'upload_filetypes' => implode( ' ', $upload_filetypes ),