Skip to:
Content

bbPress.org

Ticket #2618: 2618.3.diff

File 2618.3.diff, 3.3 KB (added by sudar, 7 years ago)

Added filter for both from and to address

  • src/includes/common/functions.php

     
    10621062        $reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );
    10631063        $reply_url     = bbp_get_reply_url( $reply_id );
    10641064        $blog_name     = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    1065         $do_not_reply  = '<noreply@' . ltrim( get_home_url(), '^(http|https)://' ) . '>';
     1065        $do_not_reply  = 'noreply@' . ltrim( get_home_url(), '^(http|https)://' );
    10661066
     1067        $from_email    = apply_filters( 'bbp_subscription_from_email', $do_not_reply );
     1068
    10671069        // For plugins to filter messages per reply/topic/user
    10681070        $message = sprintf( __( '%1$s wrote:
    10691071
     
    10991101        $headers = array();
    11001102
    11011103        // Setup the From header
    1102         $headers[] = 'From: ' . get_bloginfo( 'name' ) . ' ' . $do_not_reply;
     1104        $headers[] = 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>';
    11031105
    11041106        // Get topic subscribers and bail if empty
    11051107        $user_ids = bbp_get_topic_subscribers( $topic_id, true );
     
    11221124        /** Send it ***************************************************************/
    11231125
    11241126        // Custom headers
    1125         $headers = apply_filters( 'bbp_subscription_mail_headers', $headers );
     1127        $headers  = apply_filters( 'bbp_subscription_mail_headers', $headers );
     1128        $to_email = apply_filters( 'bbp_subscription_to_email', $do_not_reply );
    11261129
    11271130        do_action( 'bbp_pre_notify_subscribers', $reply_id, $topic_id, $user_ids );
    11281131
    11291132        // Send notification email
    1130         wp_mail( $do_not_reply, $subject, $message, $headers );
     1133        wp_mail( $to_email, $subject, $message, $headers );
    11311134
    11321135        do_action( 'bbp_post_notify_subscribers', $reply_id, $topic_id, $user_ids );
    11331136
     
    12021205        $topic_content = strip_tags( bbp_get_topic_content( $topic_id ) );
    12031206        $topic_url     = get_permalink( $topic_id );
    12041207        $blog_name     = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
    1205         $do_not_reply  = '<noreply@' . ltrim( get_home_url(), '^(http|https)://' ) . '>';
     1208        $do_not_reply  = 'noreply@' . ltrim( get_home_url(), '^(http|https)://' );
    12061209
     1210        $from_email    = apply_filters( 'bbp_subscription_from_email', $do_not_reply );
     1211
    12071212        // For plugins to filter messages per reply/topic/user
    12081213        $message = sprintf( __( '%1$s wrote:
    12091214
     
    12391244        $headers = array();
    12401245
    12411246        // Setup the From header
    1242         $headers[] = 'From: ' . get_bloginfo( 'name' ) . ' ' . $do_not_reply;
     1247        $headers[] = 'From: ' . get_bloginfo( 'name' ) . ' <' . $from_email . '>';
    12431248
    12441249        // Get topic subscribers and bail if empty
    12451250        $user_ids = bbp_get_forum_subscribers( $forum_id, true );
     
    12621267        /** Send it ***************************************************************/
    12631268
    12641269        // Custom headers
    1265         $headers = apply_filters( 'bbp_subscription_mail_headers', $headers );
     1270        $headers  = apply_filters( 'bbp_subscription_mail_headers', $headers );
     1271        $to_email = apply_filters( 'bbp_subscription_to_email', $do_not_reply );
    12661272
    12671273        do_action( 'bbp_pre_notify_forum_subscribers', $topic_id, $forum_id, $user_ids );
    12681274
    12691275        // Send notification email
    1270         wp_mail( $do_not_reply, $subject, $message, $headers );
     1276        wp_mail( $to_email, $subject, $message, $headers );
    12711277
    12721278        do_action( 'bbp_post_notify_forum_subscribers', $topic_id, $forum_id, $user_ids );
    12731279