bp_get_group_type

Get the type of the current group in the loop.

Description

(string) bp_get_group_type( (bool) $group = false ); 

Returns (string)

Parameters (1)

0. $group — Optional. (bool) => false
Group object. Default: current group in loop.

Usage

  1. if ( !function_exists( 'bp_get_group_type' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-groups/bp-groups-template.php'; 
  3.  
  4. // Optional. Group object. 
  5. // Default: current group in loop. 
  6. $group = false; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_get_group_type($group); 
  10.  

Defined (1)

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

/bp-groups/bp-groups-template.php  
  1. function bp_get_group_type( $group = false ) { 
  2. global $groups_template; 
  3.  
  4. if ( empty( $group ) ) { 
  5. $group =& $groups_template->group; 
  6.  
  7. if ( 'public' == $group->status ) { 
  8. $type = __( "Public Group", buddypress ); 
  9. } elseif ( 'hidden' == $group->status ) { 
  10. $type = __( "Hidden Group", buddypress ); 
  11. } elseif ( 'private' == $group->status ) { 
  12. $type = __( "Private Group", buddypress ); 
  13. } else { 
  14. $type = ucwords( $group->status ) . ' ' . __( 'Group', buddypress ); 
  15.  
  16. /** 
  17. * Filters the type for the current group in the loop. 
  18. * @since 1.0.0 
  19. * @since 2.5.0 Added the `$group` parameter. 
  20. * @param string $type Type for the current group in the loop. 
  21. * @param object $group Group object. 
  22. */ 
  23. return apply_filters( 'bp_get_group_type', $type, $group );