bp_get_total_media_count()
Return the total media count in your BP instance.
Description
Return
(int) Media count.
Source
File: bp-media/bp-media-functions.php
function bp_get_total_media_count() {
global $wpdb;
$count = wp_cache_get( 'bp_total_media_count', 'bp' );
$bp = buddypress();
if ( false === $count ) {
$privacy = array( 'public' );
if ( is_user_logged_in() ) {
$privacy[] = 'loggedin';
}
$privacy = "'" . implode( "', '", $privacy ) . "'";
$count = $wpdb->get_var( "SELECT COUNT(*) FROM {$bp->media->table_name} WHERE privacy IN ({$privacy})" );
wp_cache_set( 'bp_total_media_count', $count, 'bp' );
}
/**
* Filters the total number of media.
*
* @since BuddyBoss 1.0.0
*
* @param int $count Total number of media.
*/
return apply_filters( 'bp_get_total_media_count', $count );
}
Changelog
| Version | Description |
|---|---|
| BuddyBoss 1.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.