BP_REST_Groups_Details_Endpoint::get_group_tab_count( sting $slug, string $type )
Get group count for the tab.
Description
Parameters
- $slug
-
(sting) (Required) Group tab object slug.
- $type
-
(string) (Required) Active, newest, alphabetical, random, popular.
Return
(int)
Source
File: bp-groups/classes/class-bp-rest-groups-details-endpoint.php
protected function get_group_tab_count( $slug, $type ) { $count = 0; $user_id = ! empty( get_current_user_id() ) ? ( get_current_user_id() ) : false; switch ( $slug ) { case 'all': $groups = groups_get_groups( array( 'type' => $type ) ); if ( ! empty( $groups ) && isset( $groups['total'] ) ) { $count = $groups['total']; } break; case 'personal': $groups = groups_get_groups( array( 'type' => $type, 'user_id' => $user_id, ) ); if ( ! empty( $groups ) && isset( $groups['total'] ) ) { $count = $groups['total']; } break; } return $count; }
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.