Skip to:
Content

bbPress.org

Changeset 5642


Ignore:
Timestamp:
03/17/2015 03:18:31 AM (6 years ago)
Author:
johnjamesjacoby
Message:

Update bbp_get_do_not_reply_address() to use $_SERVER['SERVER_NAME'] over get_home_url() to improve compatibility with mapped domains and more complex installations. See #2618 (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/functions.php

    r5640 r5642  
    10071007 * using `admin_email` instead, though this is not normally publicized.
    10081008 *
     1009 * We use `$_SERVER['SERVER_NAME']` here to mimic similar functionality in
     1010 * WordPress core. Previously, we used `get_home_url()` to use already validated
     1011 * user input, but it was causing issues in some installations.
     1012 *
    10091013 * @since bbPress (r5409)
    10101014 *
     1015 * @see  wp_mail
     1016 * @see  wp_notify_postauthor
     1017 * @link https://bbpress.trac.wordpress.org/ticket/2618
     1018 *
    10111019 * @return string
    10121020 */
    10131021function bbp_get_do_not_reply_address() {
    1014     $email = 'noreply@' . preg_replace( '@^https?://(www\.)?@i', '', get_home_url() );
    1015     return apply_filters( 'bbp_get_do_not_reply_address', $email );
     1022    $sitename = strtolower( $_SERVER['SERVER_NAME'] );
     1023    if ( substr( $sitename, 0, 4 ) === 'www.' ) {
     1024        $sitename = substr( $sitename, 4 );
     1025    }
     1026    return apply_filters( 'bbp_get_do_not_reply_address', 'noreply@' . $sitename );
    10161027}
    10171028
Note: See TracChangeset for help on using the changeset viewer.