bp_get_group_has_avatar

Return whether a group has an avatar.

Description

(boolean) bp_get_group_has_avatar( (bool) $group_id = false ); 

Returns (boolean)

Parameters (1)

0. $group_id — Optional. (bool) => false
Group ID to check.

Usage

  1. if ( !function_exists( 'bp_get_group_has_avatar' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4. // Group ID to check. 
  5. $group_id = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_get_group_has_avatar($group_id); 
  9.  

Defined (1)

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

/bp-groups/bp-groups-template.php  
  1. function bp_get_group_has_avatar( $group_id = false ) { 
  2.  
  3. if ( false === $group_id ) { 
  4. $group_id = bp_get_current_group_id(); 
  5.  
  6. $avatar_args = array( 
  7. 'item_id' => $group_id,  
  8. 'object' => 'group',  
  9. 'no_grav' => true,  
  10. 'html' => false,  
  11. 'type' => 'thumb',  
  12. ); 
  13.  
  14. $group_avatar = bp_core_fetch_avatar( $avatar_args ); 
  15.  
  16. if ( bp_core_avatar_default( 'local', $avatar_args ) === $group_avatar ) { 
  17. return false; 
  18.  
  19. return true;