bp_get_current_group_id

Returns the ID of the current group.

Description

(int) bp_get_current_group_id(); 

Returns (int)

$current_group_id The id of the current group, if there is one.


Usage

  1. if ( !function_exists( 'bp_get_current_group_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bp_get_current_group_id(); 
  7.  

Defined (1)

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

/bp-groups/bp-groups-template.php  
  1. function bp_get_current_group_id() { 
  2. $current_group = groups_get_current_group(); 
  3. $current_group_id = isset( $current_group->id ) ? (int) $current_group->id : 0; 
  4.  
  5. /** 
  6. * Filters the ID of the current group. 
  7. * @since 1.5.0 
  8. * @param int $current_group_id ID of the current group. 
  9. * @param object $current_group Instance holding the current group. 
  10. */ 
  11. return apply_filters( 'bp_get_current_group_id', $current_group_id, $current_group );