user_has_cap

Dynamically filter a user's capabilities.

Description

apply_filters( 'user_has_cap', (unknown) $this_allcaps, (unknown) $caps, (unknown) $args ); 

Parameters (3)

0. $this_allcaps (unknown)
The this allcaps.
1. $caps (unknown)
The caps.
2. $args (unknown)
The args.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-includes/backpress/class.bp-user.php  
  1. $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );