bp_messages_clear_cache_on_message_delete( int|array $thread_ids, int $user_id )
Clear message cache after a message thread is deleted.
Description Description
Parameters Parameters
- $thread_ids
-
(Required) If single thread, the thread ID. Otherwise, an array of thread IDs.
- $user_id
-
(Required) ID of the user that the threads were deleted for.
Source 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' ); 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 |
---|---|
2.0.0 | Introduced. |