function _user_expire_save in User Expire 8
Same name and namespace in other branches
- 7 user_expire.module \_user_expire_save()
Save expiration date from user edit form.
Parameters
object $account: A user object to modify.
2 calls to _user_expire_save()
- user_expire_user_insert in ./
user_expire.module - Implements hook_user_insert().
- user_expire_user_profile_form_submit in ./
user_expire.module - Submit callback for the user profile form to save the contact page setting.
File
- ./
user_expire.module, line 148 - Main module file for User expire module.
Code
function _user_expire_save($account) {
if (isset($account->user_expiration) && $account->user_expiration) {
if (is_array($account->user_expiration_date) && isset($account->user_expiration_date['month'])) {
$time_for_datetime = $account->user_expiration_date['year'] . '-' . $account->user_expiration_date['month'] . '-' . $account->user_expiration_date['day'];
}
else {
$time_for_datetime = $account->user_expiration_date;
}
$new_date = new DateTime($time_for_datetime, new DateTimeZone(date_default_timezone_get()));
$new_date
->setTime(0, 0, 0);
$timestamp = $new_date
->getTimestamp();
user_expire_set_expiration($account, $timestamp);
}
else {
user_expire_set_expiration($account);
}
}