Opened 10 years ago
Closed 7 years ago
#2834 closed defect (bug) (fixed)
Reply to reply doesn't generate proper BuddyPress notifications
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.6 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | Extend - BuddyPress | Keywords: | commit |
Cc: |
Description
There seems to be an error in the bbp_buddypress_add_notification
method defined in /includes/extend/buddypress/notifications.php
Whenever a nested reply is created, this piece of code gets evaluated:
// Notify the immediate reply author if not the current reply author
if ( !empty( $reply_to ) && ( $author_id !== $reply_to_item_id ) ) {
$args['secondary_item_id'] = $reply_to_item_id ;
bp_notifications_add_notification( $args );
}
You can see the author of the reply the current message replies to is NOT notified - instead, the topic author is notified as the $args['user_id']
stays unchanged. The issue here is that the topic author is notified even in cases when it is them who posts the reply to an existing reply under their topic.
To clarify, here are the steps to reproduce the issue:
- User Alice creates a new topic.
- User Bob replies under this topic.
- User Alice replies to Bob's reply.
Expected outcome:
- Alice is notified when Bob replies under her topic.
- Bob is notified when Alice replies to his reply.
- Alice is not notified when Alice replies under Bob's reply.
Current outcome:
- Alice is notified when Bob replies under her topic.
- Bob is NOT notified when Alice replies to his reply.
- Instead, Alice IS notified when Alice replies under Bob's reply.
I believe something along these lines would be enough to mitigate the issue:
// Notify the immediate reply author if not the current reply author
if ( !empty( $reply_to ) && ( $author_id !== $reply_to_item_id ) ) {
$args['user_id'] = $reply_to_item_id;
$args['secondary_item_id'] = $topic_author_id;
bp_notifications_add_notification( $args );
}
Please let me know if anything is unclear, thanks!
jpolakovic,
Thanks for the great report, everything looks pretty clear to me :)
Related: #2495/r5232