bbp_get_forum_group_ids

Get group ID's for a forum.

Description

bbp_get_forum_group_ids( (int) $forum_id = 0 ); 

Parameters (1)

0. $forum_id — Optional. (int)
The forum id.

Usage

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

Defined (1)

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

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