bbp_get_user_role_map

Return a map of WordPress roles to bbPress roles.

Description

(array) bbp_get_user_role_map(); 

Used to automatically grant appropriate bbPress roles to WordPress users that wouldn't already have a role in the forums. Also guarantees WordPress admins get the Keymaster role.

Returns (array)

Filtered array of WordPress roles to bbPress roles


Usage

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

Defined (1)

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

/includes/users/capabilities.php  
  1. function bbp_get_user_role_map() { 
  2.  
  3. // Get the default role once here 
  4. $default_role = bbp_get_default_role(); 
  5.  
  6. // Return filtered results, forcing admins to keymasters. 
  7. return (array) apply_filters( 'bbp_get_user_role_map', array ( 
  8. 'administrator' => bbp_get_keymaster_role(),  
  9. 'editor' => $default_role,  
  10. 'author' => $default_role,  
  11. 'contributor' => $default_role,  
  12. 'subscriber' => $default_role 
  13. ) );