You are here

function legal_user_is_exempt in Legal 7

Same name and namespace in other branches
  1. 8 legal.module \legal_user_is_exempt()
  2. 2.0.x legal.module \legal_user_is_exempt()

Check if user is exempt from Terms & Conditions.

Parameters

$account: A user object

Return value

bool True if the passed user is exempt

2 calls to legal_user_is_exempt()
legal_form_user_profile_form_alter in ./legal.module
Implements hook_form_FORM_ID_alter().
legal_user_login in ./legal.module
Implements hook_user_login().

File

./legal.module, line 1051
Module file for Legal.

Code

function legal_user_is_exempt($account) {

  // User 1 is exempt from accepting T&Cs, no need to display T&Cs.
  if ($account->uid === 1) {
    return TRUE;
  }
  $exempt_roles = variable_get('legal_except_roles', array());
  $account_roles = $account->roles;
  $exempt_user_roles = array_intersect_key($account_roles, $exempt_roles);
  if (count($exempt_user_roles)) {
    return TRUE;
  }
  return FALSE;
}