bp_media_clear_media_user_object_cache_on_delete( array $medias )

Clear a user’s cached media count when delete.

Description

Parameters

$medias

(Required) DB results of media items.

Source

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

function bp_media_clear_media_user_object_cache_on_delete( $medias ) {
	if ( ! empty( $medias[0] ) ) {
		foreach ( (array) $medias[0] as $deleted_media ) {
			$user_id = ! empty( $deleted_media->user_id ) ? $deleted_media->user_id : false;

			if ( $user_id ) {
				wp_cache_delete( 'bp_total_media_for_user_' . $user_id, 'bp' );
				wp_cache_delete( 'bp_total_group_media_for_user_' . $user_id, 'bp' );
			}
		}
	}
}

Changelog

Changelog
Version Description
BuddyBoss 1.2.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.