Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/09/2014 07:46:01 PM (11 years ago)
Author:
boonebgorges
Message:

When a message is deleted, delete corresponding notifications

Fixes #5289

Props imath, henrywright

File:
1 edited

Legend:

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

    r7650 r8099  
    190190}
    191191add_action( 'messages_screen_conversation', 'bp_messages_screen_inbox_mark_notifications', 10 );
     192
     193/**
     194 * When a message is deleted, delete corresponding notifications.
     195 *
     196 * @since BuddyPress (2.0.0)
     197 *
     198 * @param int $message_id ID of the message.
     199 */
     200function bp_messages_message_delete_notifications( $message_id = 0 ) {
     201    if ( bp_is_active( 'notifications' ) && ! empty( $message_id ) ) {
     202        bp_notifications_delete_notifications_by_item_id( bp_loggedin_user_id(), (int) $message_id, buddypress()->messages->id, 'new_message' );
     203    }
     204}
     205add_action( 'messages_thread_deleted_thread', 'bp_messages_message_delete_notifications', 10, 1 );
Note: See TracChangeset for help on using the changeset viewer.