WordPress.org

Make WordPress Core

Ticket #25239: 25239.2.diff

File 25239.2.diff, 3.6 KB (added by jesin, 4 years ago)

Refreshed 25239.diff

  • src/wp-includes/ms-functions.php

     
    796796
    797797        $activate_url = esc_url($activate_url);
    798798        $admin_email = get_site_option( 'admin_email' );
    799         if ( $admin_email == '' )
    800                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     799        if ( $admin_email == '' ) {
     800                global $current_site;
     801                $admin_email = 'support@' . $current_site->domain;
     802        }
    801803        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    802804        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    803805        $message = sprintf(
     
    889891
    890892        // Send email with activation link.
    891893        $admin_email = get_site_option( 'admin_email' );
    892         if ( $admin_email == '' )
    893                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     894        if ( $admin_email == '' ) {
     895                global $current_site;
     896                $admin_email = 'support@' . $current_site->domain;
     897        }
    894898        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    895899        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    896900        $message = sprintf(
     
    14901494        $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
    14911495        $admin_email = get_site_option( 'admin_email' );
    14921496
    1493         if ( $admin_email == '' )
    1494                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1497        if ( $admin_email == '' ) {
     1498                $admin_email = 'support@' . $current_site->domain;
     1499        }
    14951500
    14961501        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    14971502        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     
    15691574
    15701575        $admin_email = get_site_option( 'admin_email' );
    15711576
    1572         if ( $admin_email == '' )
    1573                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1577        if ( $admin_email == '' ) {
     1578                $admin_email = 'support@' . $current_site->domain;
     1579        }
    15741580
    15751581        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15761582        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
  • src/wp-includes/pluggable.php

     
    323323
    324324        if ( !isset( $from_email ) ) {
    325325                // Get the site domain and get rid of www.
    326                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
     326                if ( is_multisite() ) {
     327                        global $current_blog;
     328                        $sitename = $current_blog->domain;
     329                } else {
     330                        $sitename = parse_url( home_url(), PHP_URL_HOST );
     331                }
    327332                if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    328333                        $sitename = substr( $sitename, 4 );
    329334                }
     
    14661471                $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
    14671472        }
    14681473
    1469         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
     1474        if ( is_multisite() ) {
     1475                global $current_blog;
     1476                $sitename = $current_blog->domain;
     1477        } else {
     1478                $sitename = parse_url( home_url(), PHP_URL_HOST );
     1479        }
     1480        $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', $sitename );
    14701481
    14711482        if ( '' == $comment->comment_author ) {
    14721483                $from = "From: \"$blogname\" <$wp_email>";