function gdpr_consent_save_accept in GDPR Consent 7
Function to save acceptance.
Parameters
int $version: Version number.
int $revision: Revision number.
string $language: Language code.
int $tc_id: Conditions identifier.
int $uid: User uid.
3 calls to gdpr_consent_save_accept()
- gdpr_consent_accept_form_submit in ./
gdpr_consent.module - Implements hook_form_id_submit().
- gdpr_consent_user_insert in ./
gdpr_consent.module - Implements hook_user_insert().
- gdpr_consent_user_update in ./
gdpr_consent.module - Implements hook_user_update().
File
- ./
gdpr_consent.module, line 837 - Module file for GDPR Consent.
Code
function gdpr_consent_save_accept($version, $revision, $language, $tc_id, $uid) {
$gdpr_consent_account = gdpr_consent_get_accept($uid);
if (!empty($gdpr_consent_account['language'])) {
$conditions = gdpr_consent_get_conditions($gdpr_consent_account['language']);
}
else {
$conditions = gdpr_consent_get_conditions();
}
$accept_exists = gdpr_consent_version_check($uid, $conditions['version'], $conditions['revision'], $gdpr_consent_account);
if ($accept_exists) {
return;
}
$accepted = time();
$data = array(
'version' => $version,
'revision' => $revision,
'language' => $language,
'tc_id' => $tc_id,
'uid' => $uid,
'accepted' => $accepted,
'revoked' => 0,
);
db_insert('gdpr_consent_accepted')
->fields($data)
->execute();
module_invoke_all('gdpr_consent_accepted', $data);
}