bbp_map_primary_meta_caps

Maps primary capabilities.

Description

(array) bbp_map_primary_meta_caps( (array) $caps = array(), (string) $cap = '', (int) $user_id = 0, (array) $args = array() ); 

Returns (array)

Actual capabilities for meta capability

Parameters (4)

0. $caps — Optional. (array) => array()
Capabilities for meta capability
1. $cap — Optional. (string) => ''
Capability name
2. $user_id — Optional. (int)
The user id.
3. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'bbp_map_primary_meta_caps' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/users/capabilities.php'; 
  3.  
  4. // Capabilities for meta capability 
  5. $caps = array(); 
  6.  
  7. // Capability name 
  8. $cap = ''; 
  9.  
  10. // The user id. 
  11. $user_id = -1; 
  12.  
  13. // The args. 
  14. $args = array(); 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bbp_map_primary_meta_caps($caps, $cap, $user_id, $args); 
  18.  

Defined (1)

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

/includes/users/capabilities.php  
  1. function bbp_map_primary_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) { 
  2.  
  3. // What capability is being checked? 
  4. switch ( $cap ) { 
  5. case 'spectate' : 
  6. case 'participate' : 
  7. case 'moderate' : 
  8.  
  9. // Do not allow inactive users 
  10. if ( bbp_is_user_inactive( $user_id ) ) { 
  11. $caps = array( 'do_not_allow' ); 
  12.  
  13. // Moderators are always participants 
  14. } else { 
  15. $caps = array( $cap ); 
  16.  
  17. break; 
  18.  
  19. return apply_filters( 'bbp_map_primary_meta_caps', $caps, $cap, $user_id, $args );