Skip to:
Content

bbPress.org

Ticket #3341: fix-mark-notifications-as-read.patch

File fix-mark-notifications-as-read.patch, 2.4 KB (added by konnektiv, 5 years ago)
  • includes/extend/buddypress/notifications.php

    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 = 
    6262function bbp_format_buddypress_notifications( $content, $item_id, $secondary_item_id, $action_item_count, $format, $component_action_name, $component_name, $id ) {
    6363
    6464        // 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 ) {
    6666                return $content;
    6767        }
    6868
    function bbp_format_buddypress_notifications( $content, $item_id, $secondary_ite 
    8686        // Multiple
    8787        if ( $action_item_count > 1 ) {
    8888                $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 );
    9090
    9191        // Single
    9292        } else {
    function bbp_buddypress_add_notification( $reply_id = 0, $topic_id = 0, $forum_i 
    148148                'user_id'          => $topic_author_id,
    149149                'item_id'          => $reply_id,
    150150                'component_name'   => bbp_get_component_name(),
    151                 'component_action' => 'bbp_new_reply',
     151                'component_action' => "bbp_new_reply_$topic_id",
    152152                'date_notified'    => get_post( $reply_id )->post_date,
    153153        );
    154154
    function bbp_buddypress_mark_notifications( $action = '' ) { 
    204204        if ( ! bbp_has_errors() ) {
    205205
    206206                // 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" );
    208208
    209209                // Do additional subscriptions actions
    210210                do_action( 'bbp_notifications_handler', $success, $user_id, $topic_id, $action );