bbp_filter_blog_editable_roles

Removes the bbPress roles from the editable roles array.

Description

(array) bbp_filter_blog_editable_roles( (array) $all_roles = array() ); 

This used to use array_diff_assoc() but it randomly broke before 2.2 release. Need to research what happened, and if there's a way to speed this up.

Returns (array)

Parameters (1)

0. $all_roles — Optional. (array) => array()
All registered roles

Usage

  1. if ( !function_exists( 'bbp_filter_blog_editable_roles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/capabilities.php'; 
  3.  
  4. // All registered roles 
  5. $all_roles = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbp_filter_blog_editable_roles($all_roles); 
  9.  

Defined (1)

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

/includes/core/capabilities.php  
  1. function bbp_filter_blog_editable_roles( $all_roles = array() ) { 
  2.  
  3. // Loop through bbPress roles 
  4. foreach ( array_keys( bbp_get_dynamic_roles() ) as $bbp_role ) { 
  5.  
  6. // Loop through WordPress roles 
  7. foreach ( array_keys( $all_roles ) as $wp_role ) { 
  8.  
  9. // If keys match, unset 
  10. if ( $wp_role === $bbp_role ) { 
  11. unset( $all_roles[$wp_role] ); 
  12.  
  13. return $all_roles;