bbp_add_forums_roles

Add the bbPress roles to the $wp_roles global.

Description

(WP_Roles) bbp_add_forums_roles(); 

We do this to avoid adding these values to the database.

Returns (WP_Roles)

The main $wp_roles global


Usage

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

Defined (1)

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

/includes/core/capabilities.php  
  1. function bbp_add_forums_roles() { 
  2. $wp_roles = bbp_get_wp_roles(); 
  3.  
  4. foreach ( bbp_get_dynamic_roles() as $role_id => $details ) { 
  5. $wp_roles->roles[$role_id] = $details; 
  6. $wp_roles->role_objects[$role_id] = new WP_Role( $role_id, $details['capabilities'] ); 
  7. $wp_roles->role_names[$role_id] = $details['name']; 
  8.  
  9. return $wp_roles;