function inactive_user_validate in Inactive User 7
Verifies the admin email submission is a properly formatted address.
File
- ./
inactive_user.module, line 249 - The inactive user module controls inactive users.
Code
function inactive_user_validate($form, &$form_state) {
$valid_email = $form_state['values']['inactive_user_admin_email'];
$mails = explode(',', $valid_email);
$count = 0;
foreach ($mails as $mail) {
if ($mail && !valid_email_address(trim($mail))) {
$invalid[] = $mail;
$count++;
}
}
if ($count == 1) {
form_set_error('inactive_user_admin_email', t('%mail is not a valid e-mail address', array(
'%mail' => $invalid[0],
)));
}
elseif ($count > 1) {
form_set_error('inactive_user_admin_email', t('The following e-mail addresses are invalid: %mail', array(
'%mail' => implode(', ', $invalid),
)));
}
}