BP_Role

The BuddyPress BP Role class.

Defined (1)

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

/bp-forums/bbpress/bb-includes/backpress/class.bp-roles.php  
  1. class BP_Role { 
  2. var $name; 
  3. var $capabilities; 
  4.  
  5. function __construct($role, $capabilities) { 
  6. $this->name = $role; 
  7. $this->capabilities = $capabilities; 
  8.  
  9. function BP_Role($role, $capabilities) { 
  10. $this->__construct($role, $capabilities); 
  11.  
  12. function add_cap($cap, $grant = true) { 
  13. $this->capabilities[$cap] = $grant; 
  14.  
  15. function remove_cap($cap) { 
  16. unset($this->capabilities[$cap]); 
  17.  
  18. function has_cap($cap) { 
  19. $capabilities = apply_filters('role_has_cap', $this->capabilities, $cap, $this->name); 
  20. $grant = !empty( $capabilities[$cap] ); 
  21. return apply_filters("{$this->name}_has_cap", $grant); 
  22.