bbp_get_dynamic_roles

Fetch a filtered list of forum roles that the current user is allowed to have.

Description

(array) bbp_get_dynamic_roles(); 

Simple function who's main purpose is to allow filtering of the list of forum roles so that plugins can remove inappropriate ones depending on the situation or user making edits.

Specifically because without filtering, anyone with the edit_users capability can edit others to be administrators, even if they are only editors or authors. This filter allows admins to delegate user management.

Returns (array)


Usage

  1. if ( !function_exists( 'bbp_get_dynamic_roles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/core/capabilities.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = bbp_get_dynamic_roles(); 
  7.  

Defined (1)

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

/includes/core/capabilities.php  
  1. function bbp_get_dynamic_roles() { 
  2. return (array) apply_filters( 'bbp_get_dynamic_roles', array( 
  3.  
  4. // Keymaster 
  5. bbp_get_keymaster_role() => array( 
  6. 'name' => __( 'Keymaster', bbpress ),  
  7. ),  
  8.  
  9. // Moderator 
  10. bbp_get_moderator_role() => array( 
  11. 'name' => __( 'Moderator', bbpress ),  
  12. ),  
  13.  
  14. // Participant 
  15. 'name' => __( 'Participant', bbpress ),  
  16. ),  
  17.  
  18. // Spectator 
  19. bbp_get_spectator_role() => array( 
  20. 'name' => __( 'Spectator', bbpress ),  
  21. ),  
  22.  
  23. // Blocked 
  24. bbp_get_blocked_role() => array( 
  25. 'name' => __( 'Blocked', bbpress ),  
  26. ) );