bp_messages_message_delete_notifications( int $thread_id, array $message_ids )

When a message is deleted, delete corresponding notifications.

Description

Parameters

$thread_id

(int) (Required) ID of the thread.

$message_ids

(array) (Required) IDs of the messages.

Source

File: bp-messages/bp-messages-notifications.php

function bp_messages_message_delete_notifications( $thread_id, $message_ids ) {
	// For each recipient, delete notifications corresponding to each message.
	$thread = new BP_Messages_Thread( $thread_id );
	foreach ( $thread->get_recipients() as $recipient ) {
		foreach ( $message_ids as $message_id ) {
			bp_notifications_delete_notifications_by_item_id( $recipient->user_id, (int) $message_id, buddypress()->messages->id, 'new_message' );
		}
	}
}

Changelog

Changelog
Version Description
BuddyPress 2.0.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.