Skip to:
Content

BuddyPress.org

Ticket #7569: 7569.diff

File 7569.diff, 1.2 KB (added by boonebgorges, 4 years ago)
  • src/bp-messages/bp-messages-notifications.php

    diff --git a/src/bp-messages/bp-messages-notifications.php b/src/bp-messages/bp-messages-notifications.php
    index 2bf095e92..750e2388b 100644
    a b function bp_messages_screen_conversation_mark_notifications() { 
    204204add_action( 'thread_loop_start', 'bp_messages_screen_conversation_mark_notifications', 10 );
    205205
    206206/**
     207 * Mark new message notification as read when the corresponding message is mark read.
     208 *
     209 * This callback covers mark-as-read bulk actions.
     210 *
     211 * @since 3.0.0
     212 *
     213 * @param int $thread_id ID of the thread being marked as read.
     214 */
     215function bp_messages_mark_notification_on_mark_thread( $thread_id ) {
     216        $thread_messages = BP_Messages_Thread::get_messages( $thread_id );
     217
     218        foreach ( $thread_messages as $thread_message ) {
     219                bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), $thread_message->id, buddypress()->messages->id, 'new_message' );
     220        }
     221}
     222add_action( 'messages_thread_mark_as_read', 'bp_messages_mark_notification_on_mark_thread' );
     223
     224/**
    207225 * When a message is deleted, delete corresponding notifications.
    208226 *
    209227 * @since 2.0.0