Skip to:
Content

BuddyPress.org

Changeset 11800


Ignore:
Timestamp:
01/05/2018 04:32:57 PM (4 years ago)
Author:
djpaul
Message:

Notifications, Messages: clear new message notification when the corresponding message is marked read.

Fixes #7569

Props boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-notifications.php

    r11606 r11800  
    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 *
Note: See TracChangeset for help on using the changeset viewer.