function gdpr_consent_user_login in GDPR Consent 7
Implements hook_user_login().
File
- ./
gdpr_consent.module, line 656 - Module file for GDPR Consent.
Code
function gdpr_consent_user_login(&$edit, $account) {
global $language, $user;
if (!empty($user->language)) {
$lang = $user->language;
}
else {
$lang = $language->language;
}
// If this profile belongs to user 1 or if it has an exempt user role we don't
// display Consent.
if (gdpr_consent_user_is_exempt($user)) {
return;
}
// Get last accepted version for this account.
$gdpr_consent_account = gdpr_consent_get_accept($user->uid);
// If no version has been accepted yet, get version with current
// language revision.
if (!isset($gdpr_consent_account['version'])) {
$conditions = gdpr_consent_get_conditions($lang);
// No conditions set yet.
if (empty($conditions['conditions'])) {
return;
}
}
else {
// Get version / revision of last accepted language.
$conditions = gdpr_consent_get_conditions($lang);
// No conditions set yet.
if (empty($conditions['conditions'])) {
return;
}
// Check latest version of Consent has been accepted.
$accepted = gdpr_consent_version_check($user->uid, $conditions['version'], $conditions['revision'], $gdpr_consent_account);
if ($accepted) {
return;
}
}
// Init hook handles this. In place to handle single request.
$_SESSION['no_consent_on_login'] = TRUE;
}