You are here

function _piwik_visibility_user in Piwik Web Analytics 6

Same name and namespace in other branches
  1. 8 piwik.module \_piwik_visibility_user()
  2. 5 piwik.module \_piwik_visibility_user()
  3. 6.2 piwik.module \_piwik_visibility_user()
  4. 7.2 piwik.module \_piwik_visibility_user()
  5. 7 piwik.module \_piwik_visibility_user()

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 Piwik.

2 calls to _piwik_visibility_user()
piwik_footer in ./piwik.module
Implementation of hook_footer() to insert Javascript at the end of the page.
piwik_init in ./piwik.module

File

./piwik.module, line 282
Drupal Module: Piwik Adds the required Javascript to the bottom of all your Drupal pages to allow tracking by the Piwik statistics package.

Code

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

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

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