From 6952dd47d894eafaa23b9577665843ca0aadf768 Mon Sep 17 00:00:00 2001
From: Christoph Herbst <chris.p.herbst@gmail.com>
Date: Fri, 14 Feb 2020 15:26:03 +0100
Subject: [PATCH] fix reply notifications
---
includes/extend/buddypress/notifications.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/includes/extend/buddypress/notifications.php b/includes/extend/buddypress/notifications.php
index 5f6b6b0..8592ddf 100644
a
|
b
|
function bbp_filter_notifications_get_registered_components( $component_names = |
62 | 62 | function bbp_format_buddypress_notifications( $content, $item_id, $secondary_item_id, $action_item_count, $format, $component_action_name, $component_name, $id ) { |
63 | 63 | |
64 | 64 | // Bail if not the notification action we are looking for |
65 | | if ( 'bbp_new_reply' !== $component_action_name ) { |
| 65 | if ( strpos( $component_action_name, 'bbp_new_reply' ) !== 0 ) { |
66 | 66 | return $content; |
67 | 67 | } |
68 | 68 | |
… |
… |
function bbp_format_buddypress_notifications( $content, $item_id, $secondary_ite |
86 | 86 | // Multiple |
87 | 87 | if ( $action_item_count > 1 ) { |
88 | 88 | $filter = 'bbp_multiple_new_subscription_notification'; |
89 | | $text = sprintf( esc_html__( 'You have %d new replies', 'bbpress' ), $action_item_count ); |
| 89 | $text = sprintf( esc_html__( 'You have %d new replies to %s', 'bbpress' ), $action_item_count, $topic_title ); |
90 | 90 | |
91 | 91 | // Single |
92 | 92 | } else { |
… |
… |
function bbp_buddypress_add_notification( $reply_id = 0, $topic_id = 0, $forum_i |
148 | 148 | 'user_id' => $topic_author_id, |
149 | 149 | 'item_id' => $reply_id, |
150 | 150 | 'component_name' => bbp_get_component_name(), |
151 | | 'component_action' => 'bbp_new_reply', |
| 151 | 'component_action' => "bbp_new_reply_$topic_id", |
152 | 152 | 'date_notified' => get_post( $reply_id )->post_date, |
153 | 153 | ); |
154 | 154 | |
… |
… |
function bbp_buddypress_mark_notifications( $action = '' ) { |
204 | 204 | if ( ! bbp_has_errors() ) { |
205 | 205 | |
206 | 206 | // Attempt to clear notifications for the current user from this topic |
207 | | $success = bp_notifications_mark_notifications_by_item_id( $user_id, $topic_id, bbp_get_component_name(), 'bbp_new_reply' ); |
| 207 | $success = bp_notifications_mark_notifications_by_type( $user_id, bbp_get_component_name(), "bbp_new_reply_$topic_id" ); |
208 | 208 | |
209 | 209 | // Do additional subscriptions actions |
210 | 210 | do_action( 'bbp_notifications_handler', $success, $user_id, $topic_id, $action ); |