You are here

function _statcounter_visibility_user in StatCounter 7.2

Tracking visibility check for an user object.

Parameters

$account: A user object containing an array of roles to check.

Return value

boolean A decision on if the current user is being tracked by Statcounter.

1 call to _statcounter_visibility_user()
statcounter_page_alter in ./statcounter.module
Implements hook_page_alter() to insert JavaScript to the appropriate scope/region of the page.

File

./statcounter.module, line 268
Drupal Module: Statcounter Adds the required Javascript to the bottom of all your Drupal pages to allow tracking by the Statcounter statistics service.

Code

function _statcounter_visibility_user($account) {
  $enabled = FALSE;

  // Is current user a member of a role that should be tracked?
  if (_statcounter_visibility_header($account) && _statcounter_visibility_roles($account)) {

    // Use the user's block visibility setting, if necessary.
    if (($custom = variable_get('statcounter_custom', 0)) != 0) {
      if ($account->uid && isset($account->data['statcounter']['custom'])) {
        $enabled = $account->data['statcounter']['custom'];
      }
      else {
        $enabled = $custom == 1;
      }
    }
    else {
      $enabled = TRUE;
    }
  }
  return $enabled;
}