bbp_add_forum_id_to_group

Remove a forum from a group.

Description

bbp_add_forum_id_to_group( (int) $group_id = 0, (int) $forum_id = 0 ); 

Parameters (2)

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

Usage

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

Defined (1)

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

/includes/extend/buddypress/functions.php  
  1. function bbp_add_forum_id_to_group( $group_id = 0, $forum_id = 0 ) { 
  2.  
  3. // Validate forum_id 
  4. $forum_id = bbp_get_forum_id( $forum_id ); 
  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 current group IDs 
  11. $forum_ids = bbp_get_group_forum_ids( $group_id ); 
  12.  
  13. // Maybe update the groups forums 
  14. if ( !in_array( $forum_id, $forum_ids ) ) { 
  15. $forum_ids[] = $forum_id; 
  16. return bbp_update_group_forum_ids( $group_id, $forum_ids );