bp_messages_clear_cache_on_message_delete( int|array $thread_ids, int $user_id )

Clear message cache after a message thread is deleted.

Description

Parameters

$thread_ids

(int|array) (Required) If single thread, the thread ID. Otherwise, an array of thread IDs.

$user_id

(int) (Required) ID of the user that the threads were deleted for.

Source

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

function bp_messages_clear_cache_on_message_delete( $thread_ids, $user_id ) {
	// Delete thread and thread recipient cache.
	foreach( (array) $thread_ids as $thread_id ) {
		// wp_cache_delete( $thread_id, 'bp_messages_threads' );
		bp_messages_delete_thread_paginated_messages_cache( $thread_id );
		wp_cache_delete( "thread_recipients_{$thread_id}", 'bp_messages' );
	}

	// Delete unread count for logged-in user.
	wp_cache_delete( $user_id, 'bp_messages_unread_count' );
}

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.