bbp_group_is_member

Is the current user a member of the current group.

Description

bbp_group_is_member(); 

Usage

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

Defined (1)

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

/includes/extend/buddypress/functions.php  
  1. function bbp_group_is_member() { 
  2.  
  3. // Bail if user is not logged in or not looking at a group 
  4. if ( ! is_user_logged_in() || ! bp_is_group() ) 
  5. return false; 
  6.  
  7. $bbp =bbpress); 
  8.  
  9. // Set the global if not set 
  10. if ( ! isset( $bbp->current_user->is_group_member ) ) 
  11. $bbp->current_user->is_group_member = groups_is_user_member( get_current_user_id(), bp_get_current_group_id() ); 
  12.  
  13. // Return the value 
  14. return (bool) $bbp->current_user->is_group_member;