monsterinsights_get_roles

Get the user roles of this WordPress blog.

Description

(array) monsterinsights_get_roles(); 

Returns (array)


Usage

  1. if ( !function_exists( 'monsterinsights_get_roles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/helpers.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_get_roles(); 
  7.  

Defined (1)

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

/includes/helpers.php  
  1. function monsterinsights_get_roles() { 
  2. global $wp_roles; 
  3.  
  4. $all_roles = $wp_roles->roles; 
  5. $roles = array(); 
  6.  
  7. /** 
  8. * Filter: 'editable_roles' - Allows filtering of the roles shown within the plugin (and elsewhere in WP as it's a WP filter) 
  9. * @api array $all_roles 
  10. */ 
  11. $editable_roles = apply_filters( 'editable_roles', $all_roles ); 
  12.  
  13. foreach ( $editable_roles as $id => $name ) { 
  14. $roles[ $id ] = translate_user_role( $name['name'] ); 
  15.  
  16. return $roles;