bbp_get_group_forum_ids

Get forum ID's for a group.

Description

bbp_get_group_forum_ids( (int) $group_id = 0 ); 

Parameters (1)

0. $group_id — Optional. (int)
The group id.

Usage

  1. if ( !function_exists( 'bbp_get_group_forum_ids' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/extend/buddypress/functions.php'; 
  3.  
  4. // The group id. 
  5. $group_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_get_group_forum_ids($group_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/includes/extend/buddypress/functions.php  
  1. function bbp_get_group_forum_ids( $group_id = 0 ) { 
  2.  
  3. // Assume no forums 
  4. $forum_ids = array(); 
  5.  
  6. // Use current group if none is set 
  7. if ( empty( $group_id ) ) 
  8. $group_id = bp_get_current_group_id(); 
  9.  
  10. // Get the forums 
  11. if ( !empty( $group_id ) ) 
  12. $forum_ids = groups_get_groupmeta( $group_id, 'forum_id' ); 
  13.  
  14. // Make sure result is an array 
  15. if ( !is_array( $forum_ids ) ) 
  16. $forum_ids = (array) $forum_ids; 
  17.  
  18. // Trim out any empty array items 
  19. $forum_ids = array_filter( $forum_ids ); 
  20.  
  21. return (array) apply_filters( 'bbp_get_group_forum_ids', $forum_ids, $group_id );