Make WordPress Core

Ticket #25239: pluggable.php.3.diff

File pluggable.php.3.diff, 668 bytes (added by tsimmons, 7 years ago)

(Reuploading to use proper SVN diff) Replaces domain part with the typical email domain for a site, which includes the last domain part + TLD ... for example, if the site is blog.wordpress.org the email domain becomes wordpress.org

  • wp-includes/pluggable.php

     
    326326         */
    327327
    328328        if ( !isset( $from_email ) ) {
    329                 // Get the site domain and get rid of www.
    330                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
    331                 if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    332                         $sitename = substr( $sitename, 4 );
    333                 }
    334 
    335                 $from_email = 'wordpress@' . $sitename;
     329                $dom = parse_url( get_home_url( get_current_blog_id() ), PHP_URL_HOST );
     330                $from_email = 'wordpress@' . preg_replace("/^.*?([^\.]+)\.([^\.]+)$/", "$1.$2", $dom);
    336331        }
    337332
    338333        /**