BP_Media::total_group_media_count( int $group_id )
Count total media for the given group
Description
Parameters
- $group_id
-
(Required)
Return
(array|bool|int)
Source
File: bp-media/classes/class-bp-media.php
public static function total_group_media_count( $group_id = 0 ) { global $wpdb; $bp = buddypress(); $count_sql = "SELECT COUNT(*) FROM {$bp->media->table_name} WHERE group_id = {$group_id}"; $cache_group = 'bp_media_group_media_count'; $cached = bp_core_get_incremented_cache( $count_sql, $cache_group ); if ( false === $cached ) { $results = $wpdb->get_col( $count_sql ); $total_count = intval( $results[0] ); bp_core_set_incremented_cache( $count_sql, $cache_group, $total_count ); } else { $total_count = $cached; } return $total_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.