You are here

function regcode_code_element_validate in Registration codes 7

Same name and namespace in other branches
  1. 8 regcode.module \regcode_code_element_validate()
  2. 7.2 regcode.module \regcode_code_element_validate()

Validate the content of the code-field on user registration.

2 string references to 'regcode_code_element_validate'
regcode_form_user_register_form_alter in ./regcode.module
Implements hook_form_FORM_ID_alter().
regcode_voucher_form_user_profile_form_alter in regcode_voucher/regcode_voucher.module
Implements hook_form_FORM_ID_alter().

File

./regcode.module, line 194
Main functionality and hooks of regcode module.

Code

function regcode_code_element_validate(&$element, &$form_state) {
  if (drupal_strlen(trim($element['#value']))) {
    $code = regcode_code_validate($element['#value']);
    if (!is_object($code)) {
      form_error($element, regcode_errormsg($code));
      watchdog('regcode', 'User entered invalid registration code (@code)', array(
        '@code' => $element['#value'],
      ), WATCHDOG_WARNING);
    }
  }
}