function _role_expire_validate_role_expires in Role Expire 7
Same name and namespace in other branches
- 8 role_expire.module \_role_expire_validate_role_expires()
- 2.x role_expire.module \_role_expire_validate_role_expires()
Form validation handler for the role expiration on the user_profile_form().
See also
1 string reference to '_role_expire_validate_role_expires'
- role_expire_add_expiration_input in ./
role_expire.module - Add form elements to the given form that accept the role expiration times.
File
- ./
role_expire.module, line 664 - Role Expire module
Code
function _role_expire_validate_role_expires(&$form, &$form_state) {
$time = REQUEST_TIME;
foreach ($form_state['values'] as $name => $value) {
if (strpos($name, 'role_expire_') === 0 && trim($value) != '') {
$expiry_time = strtotime($value);
if (!$expiry_time) {
form_set_error($name, t("Role expiry is not in correct format."));
}
if ($expiry_time <= $time) {
form_set_error($name, t("Role expiry must be in the future."));
}
}
}
}