Opened 4 years ago
Closed 4 years ago
#8674 closed defect (bug) (worksforme)
[10.2.0] Bug in bd-activity-comment-notifier/core/functions.php:139-150
| Reported by: | jesusinica | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Activity | Version: | 10.2.0 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Please accept my apologies if the format of the report isn't what is expected, it is my first bug report in BuddyPress. I'd love to send a merge request with the fix, but I haven't found what's the process.
The bug is causing notifications to show an incorrect message when $total_user is 1 due to an incorrect logic within this if statement:
if ($total_user == 1){ if ( $activity->user_id == reset( $users ) ) { $text = sprintf( __( '%s also commented on his/her own post', 'bp-activity-comment-notifier' ), $commenting_users, bp_core_get_user_displayname( $activity->user_id ) ); } else { $text = sprintf( __( '%s also commented on %s\'s post', 'bp-activity-comment-notifier' ), $commenting_users, bp_core_get_user_displayname( $activity->user_id ) ); } } if ($total_user == 2){ $text = sprintf( __( '%s also commented on %s\'s post', 'bp-activity-comment-notifier' ), $commenting_users, bp_core_get_user_displayname( $activity->user_id ) ); } else { // <---- This else is overwritting the notification created when $total_user = 1 $text = sprintf(__('%s and %s others also commented on %s\'s post', 'bp-activity-comment-notifier'), $commenting_users, $count, bp_core_get_user_displayname($activity->user_id)); }
It feels like this section should look like this:
if ($total_user == 1) { if ($activity->user_id == reset($users)) { $text = sprintf(__('%s also commented on his/her own post', 'bp-activity-comment-notifier'), $commenting_users, bp_core_get_user_displayname($activity->user_id)); } else { $text = sprintf(__('%s also commented on %s\'s post', 'bp-activity-comment-notifier'), $commenting_users, bp_core_get_user_displayname($activity->user_id)); } } elseif ($total_user == 2) { $text = sprintf(__('%s also commented on %s\'s post', 'bp-activity-comment-notifier'), $commenting_users, bp_core_get_user_displayname($activity->user_id)); } else { $text = sprintf(__('%s and %s others also commented on %s\'s post', 'bp-activity-comment-notifier'), $commenting_users, $count, bp_core_get_user_displayname($activity->user_id)); }
Change History (3)
#2
@
4 years ago
Hi @jesusinica, @imath,
These lines don't belongs to BuddyPress. It looks like the problem is here related to plugin called BuddyPress Activity Comment Notifier. I suggest you to open a new topic in the plugin support.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi,
Here’s the PR process:
https://bpdevel.wordpress.com/2022/03/06/using-pr-to-share-your-patches-on-buddypress-trac/
Thanks for your report. I’ll look at it asap.