bp_user_can_create_groups

Filters if the current logged in user can create groups.

Description

apply_filters( 'bp_user_can_create_groups', (bool) $can_create, (int) $restricted ); 

Parameters (2)

0. $can_create (bool)
Whether the person can create groups.
1. $restricted (int)
Whether or not group creation is restricted.

Usage

To run the hook, copy the example below.
  1. $can_create = apply_filters( 'bp_user_can_create_groups', $can_create, $restricted ); 
  2.  
  3. if ( !empty( $can_create ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the bp_user_can_create_groups callback 
  2. function filter_bp_user_can_create_groups( $can_create, $restricted ) { 
  3. // make filter magic happen here... 
  4. return $can_create
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'bp_user_can_create_groups', 'filter_bp_user_can_create_groups', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'bp_user_can_create_groups', 'filter_bp_user_can_create_groups', 10, 2 ); 

Defined (1)

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

/bp-groups/bp-groups-template.php  
  1. return apply_filters( 'bp_user_can_create_groups', $can_create, $restricted );