BP_Groups_Group::get_group_type_ids()
Get an array containing ids for each group type.
Description
A bit of a kludge workaround for some issues with bp_has_groups().
Return
(array)
Source
File: bp-groups/classes/class-bp-groups-group.php
public static function get_group_type_ids() {
global $wpdb;
$bp = buddypress();
$ids = array();
$ids['all'] = $wpdb->get_col( "SELECT id FROM {$bp->groups->table_name}" );
$ids['public'] = $wpdb->get_col( "SELECT id FROM {$bp->groups->table_name} WHERE status = 'public'" );
$ids['private'] = $wpdb->get_col( "SELECT id FROM {$bp->groups->table_name} WHERE status = 'private'" );
$ids['hidden'] = $wpdb->get_col( "SELECT id FROM {$bp->groups->table_name} WHERE status = 'hidden'" );
return $ids;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.7.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.