bbp_map_topic_tag_meta_caps

Maps topic tag capabilities.

Description

(array) bbp_map_topic_tag_meta_caps( (array) $caps, (string) $cap, (int) $user_id, (mixed) $args ); 

Returns (array)

Actual capabilities for meta capability

Parameters (4)

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

Usage

  1. if ( !function_exists( 'bbp_map_topic_tag_meta_caps' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/topics/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 = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bbp_map_topic_tag_meta_caps($caps, $cap, $user_id, $args); 
  18.  

Defined (1)

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

/includes/topics/capabilities.php  
  1. function bbp_map_topic_tag_meta_caps( $caps, $cap, $user_id, $args ) { 
  2.  
  3. // What capability is being checked? 
  4. switch ( $cap ) { 
  5. case 'manage_topic_tags' : 
  6. case 'edit_topic_tags' : 
  7. case 'delete_topic_tags' : 
  8. case 'assign_topic_tags' : 
  9. case 'bbp_topic_tags_admin' : 
  10.  
  11. // Moderators can always edit 
  12. if ( user_can( $user_id, 'moderate' ) ) { 
  13. $caps = array( 'moderate' ); 
  14.  
  15. return apply_filters( 'bbp_map_topic_tag_meta_caps', $caps, $cap, $user_id, $args );