You are here

function inactive_user_custom_settings_validate in Inactive User 6

Same name and namespace in other branches
  1. 5 inactive_user.module \inactive_user_custom_settings_validate()

File

./inactive_user.module, line 216
The inactive user module controls inactive users.

Code

function inactive_user_custom_settings_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),
    )));
  }
}