You are here

function profanity_user_register_validate in Profanity 7

Form validation callback.

1 string reference to 'profanity_user_register_validate'
profanity_form_user_register_form_alter in ./profanity.module
Implements hook_form_FORM_ID_alter().

File

./profanity.module, line 567
Main {profanity} file.

Code

function profanity_user_register_validate($form, &$form_state) {
  if (variable_get('profanity_protect_user_reg', 0)) {
    $matched = FALSE;
    foreach (variable_get('profanity_protect_user_reg_lists', array()) as $list_name) {
      if (profanity_list_execute($list_name, $form_state['values']['name'], FALSE) > 0) {
        $matched = TRUE;
        break;
      }
    }
    if ($matched) {
      form_set_error('name', variable_get('profanity_protect_user_reg_message', "The username you've entered contains a word or words which aren't allowed."));
    }
  }
}