You are here

function crazyegg_is_role_allowed in Crazy Egg Integration 7

Same name and namespace in other branches
  1. 8 crazyegg.module \crazyegg_is_role_allowed()

Check if actual user role is not mentioned in `crazyegg_roles_excluded` variable

Return value

bool

1 call to crazyegg_is_role_allowed()
crazyegg_page_alter in ./crazyegg.module
Implements hook_page_alter(). Checks all conditions and injects tracking script into the page if needed

File

./crazyegg.module, line 86
The official Crazy Egg Plugin for Drupal. The easiest, free way to add your Crazy Egg tracking script to your Drupal site. See https://www.crazyegg.com for details.

Code

function crazyegg_is_role_allowed() {
  global $user;
  $excluded_roles = variable_get('crazyegg_roles_excluded', array());
  foreach ($user->roles as $rid => $role) {
    if (in_array($rid, $excluded_roles)) {
      return FALSE;
    }
  }
  return TRUE;
}