groups_total_groups_for_user( int $user_id )
Get the count of groups of which the specified user is a member.
Description
Parameters
- $user_id
-
(Optional) Default: ID of the displayed user.
Return
(int) Group count.
Source
File: bp-groups/bp-groups-functions.php
function groups_total_groups_for_user( $user_id = 0 ) { if ( empty( $user_id ) ) $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id(); $count = wp_cache_get( 'bp_total_groups_for_user_' . $user_id, 'bp' ); if ( false === $count ) { $count = BP_Groups_Member::total_group_count( $user_id ); wp_cache_set( 'bp_total_groups_for_user_' . $user_id, $count, 'bp' ); } return (int) $count; }
Changelog
Version | Description |
---|---|
BuddyPress 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.