monsterinsights_disabled_user_group

The Google Analytics for WordPress by MonsterInsights monsterinsights disabled user group function.

Description

monsterinsights_disabled_user_group(); 

Usage

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

Defined (1)

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

/includes/frontend/frontend.php  
  1. function monsterinsights_disabled_user_group( ) { 
  2. $user = wp_get_current_user(); 
  3. $disabled = false; 
  4.  
  5. $roles = monsterinsights_get_option( 'ignore_users', array() ); 
  6.  
  7. if ( ! empty( $roles ) && is_array( $roles ) ) { 
  8. foreach ( $roles as $role ) { 
  9. if ( is_string( $role ) ) { 
  10. if ( current_user_can( $role ) ) { 
  11. $disabled = true; 
  12. break; 
  13.  
  14. $track_super_admin = apply_filters( 'monsterinsights_track_super_admins', false ); 
  15. if ( $track_super_admin === false && is_super_admin() ) { 
  16. $disabled = true; 
  17.  
  18. // or if UA code is not entered 
  19. $ua_code = monsterinsights_get_ua(); 
  20. if ( empty( $ua_code ) ) { 
  21. $disabled = true; 
  22.  
  23. return apply_filters( 'monsterinsights_disabled_user_group', $disabled, $user );