bp_messages_message_delete_notifications( int $thread_id, array $message_ids )

When a message is deleted, delete corresponding notifications.


Description Description


Parameters Parameters

$thread_id

(Required) ID of the thread.

$message_ids

(Required) IDs of the messages.


Top ↑

Source 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' );
		}
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.