Skip to:
Content

BuddyPress.org

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#6375 closed defect (bug) (fixed)

Need to fix parameter in do_action statement for sending email notifications to commenters you have received comments

Reported by: dtc7240 Owned by: boonebgorges
Milestone: 2.3 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch
Cc:

Description

Hi guys. In #6057, there was some discussion concerning adding reply notifications to the new wp_bp_notifications table. I have some thoughts on that, but I'll weigh in on that discussion there after I finish this ticket.

As I'm actually running my BuddyPress site in an app environment via PhoneGap, my site features actual push notifications. The trigger I'm using to generate a push notification is the bp_notification_before_save hook. In order to generate a push notification when someone has replied to something you generated in the activity stream, I am for now using both the bp_activity_sent_reply_to_update_email and bp_activity_sent_reply_to_reply_email hooks to populate the notifications table myself.

While I was going through the code, I ran across a problem with the parameters of the bp_activity_sent_reply_to_reply_email hook that appears to just be a copy/paste oversight. I would guess that the entire if statement in which this hook is contained was originally copied from the if statement containing the bp_activity_sent_reply_to_update_email hook and then modified.

The user_id passed as a parameter in the bp_activity_sent_reply_to_reply_email do_action hook is that of the author of the activity that started the thread (as it should be in the other hook), but in this case should be the user_id of the author of the comment to which a reply is being made.

Can we please change "$original_activity->user_id" to "$parent_comment->user_id" in the "bp_activity_sent_reply_to_reply_email" hook?

Or if you're worried someone is currently using that hook with the incorrect data, create a new hook with the alteration?

Many thanks,
Scott

Change History (3)

#1 @boonebgorges
4 years ago

  • Milestone changed from Awaiting Review to 2.3

Yeah, I think you're right that this was a copy-paste error - the hook is kinda useless as is. (It's possible to get the parent_comment from the $params passed, but it is a pain.) I don't see any active use of the hook in the plugins repo or on Github, and anyone using it is probably experiencing brokenness anyway, so let's just change it.

#2 @boonebgorges
4 years ago

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

In 9764:

Pass the ID of the author of the immediate parent comment to 'bp_activity_sent_reply_to_reply_email'.

As a result of an earlier copy-and-paste error, the ID of the author of the
top-level comment was being sent. This caused the current hook to be pretty
much useless. See [3362].

Props dtc7240.
Fixes #6375.

#3 @dtc7240
4 years ago

Thanks Boone. Yeah...I'm recreating the parent_comment from the parent_id in the $params for now and then calling the function I've hooked to the other hook from there...

Note: See TracTickets for help on using tickets.