function legal_login in Legal 6.8
Same name and namespace in other branches
- 5 legal.module \legal_login()
- 6.7 legal.module \legal_login()
- 7.2 legal.module \legal_login()
- 7 legal.module \legal_login()
Require registered users to accept new T&C.
1 string reference to 'legal_login'
- legal_menu in ./
legal.module - Implementation of hook_menu().
File
- ./
legal.module, line 468 - Displays Terms & Conditions, and makes sure they are accepted before registration is accepted.
Code
function legal_login($constructor, $uid, $id_hash = NULL) {
global $language;
// Get last accepted version for this account.
$legal_account = legal_get_accept($uid);
// If no version has been accepted yet,
// get version with current language revision.
if (empty($legal_account['version'])) {
$conditions = legal_get_conditions($language->language);
// No conditions set yet.
if (empty($conditions['conditions'])) {
return;
}
}
else {
// Get version / revision of last accepted language.
$conditions = legal_get_conditions($legal_account['language']);
// No conditions set yet.
if (empty($conditions['conditions'])) {
return;
}
// Check latest version of T&C has been accepted.
$accepted = legal_version_check($uid, $conditions['version'], $conditions['revision'], $legal_account);
if ($accepted) {
return;
}
}
$form = legal_display_fields($conditions);
$form['uid'] = array(
'#type' => 'value',
'#value' => $uid,
);
$form['id_hash'] = array(
'#type' => 'value',
'#value' => $id_hash,
);
$form['tc_id'] = array(
'#type' => 'value',
'#value' => $conditions['tc_id'],
);
$form['version'] = array(
'#type' => 'value',
'#value' => $conditions['version'],
);
$form['revision'] = array(
'#type' => 'value',
'#value' => $conditions['revision'],
);
$form['language'] = array(
'#type' => 'value',
'#value' => $conditions['language'],
);
$form = legal_display_changes($form, $uid);
$redirect = 'user/' . $uid;
if (!empty($_GET['destination'])) {
$redirect = $_GET['destination'];
}
$form['#redirect'] = $redirect;
$form['save'] = array(
'#type' => 'submit',
'#value' => t('Confirm'),
);
return $form;
}