Opened 9 years ago
Closed 8 years ago
#2863 closed defect (bug) (fixed)
bbp_post_notify_subscribers still sends email to noreply even if there are no bcc's
Reported by: | coreymckrill4ttf | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | minor | Version: | 2.5.8 |
Component: | API - Subscriptions | Keywords: | has-patch |
Cc: |
Description
In bbp_notify_topic_subscribers
there are no further bailout points after...
// Loop through users foreach ( (array) $user_ids as $user_id ) { // Don't send notifications to the person who made the post if ( !empty( $reply_author ) && (int) $user_id === (int) $reply_author ) { continue; } // Get email address of subscribed user $headers[] = 'Bcc: ' . get_userdata( $user_id )->user_email; }
...so even if no bcc headers are added, the email still gets sent to the noreply address. This happens when the reply author is the only subscriber.
Attachments (2)
Change History (5)
#2
@
8 years ago
New approach. I came across this again while working on BP Emails for BBP. Currently, we pretty much build the entire email before we know if there are any subscribers. Attached patch moves the user check to an earlier position, allowing us to avoid the overhead of building the email content if there are no subscribers, or if the topic/reply author is the sole subscriber. This also prevents the noreply address from receiving emails, even when there are no BCCs.
@coreymckrill4ttf
Congrats on your first Trac ticket, and thanks!
Attached patch checks to see that we have more than one header, implying there has been a Bcc header added, before we attempt to send an email.