Skip to:
Content

bbPress.org

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's profile coreymckrill4ttf Owned by: johnjamesjacoby's profile 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)

2863.01.patch (961 bytes) - added by thebrandonallen 9 years ago.
2863.02.patch (4.7 KB) - added by thebrandonallen 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @thebrandonallen
9 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 2.6

@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.

#2 @thebrandonallen
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.

#3 @johnjamesjacoby
8 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 6264:

Subscriptions: Do not send emails when $user_ids is empty.

Also reorder some logic to optimize the users loop.

Fixes #2863. Props thebrandonallen.

Note: See TracTickets for help on using tickets.