bb_current_user_can

Whether current user has capability or role.

Description

bb_current_user_can( (string) $capability ); 

Parameters (1)

0. $capability (string)
Capability or role name.

Usage

  1. if ( !function_exists( 'bb_current_user_can' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php'; 
  3.  
  4. // Capability or role name. 
  5. $capability = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_current_user_can($capability); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php  
  1. function bb_current_user_can($capability) { 
  2. global $bb_current_user; 
  3.  
  4. $args = array_slice(func_get_args(), 1); 
  5. $args = array_merge(array($capability), $args); 
  6.  
  7. if ( empty($bb_current_user) ) { 
  8. $retvalue = false; 
  9. if ( ( $capability == 'write_topic' || $capability == 'write_topics' ) && !bb_is_login_required() ) 
  10. $retvalue = true; 
  11. } else { 
  12. $retvalue = call_user_func_array(array(&$bb_current_user, 'has_cap'), $args); 
  13.  
  14. // Use bb_user_has_cap whenever possible! This will not work everywhere. 
  15. return apply_filters('bb_current_user_can', $retvalue, $capability, $args);