You are here

function sms_user_validate_number_element in SMS Framework 7

Form element validation callback.

Validates that the phone number is valid for the system, and is not in use by another user.

2 string references to 'sms_user_validate_number_element'
sms_user_form_alter in modules/sms_user/sms_user.module
Implements hook_form_alter().
sms_user_settings_add_form in modules/sms_user/sms_user.module
Form constructor for the user number confirmation request form.

File

modules/sms_user/sms_user.module, line 624
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_validate_number_element($element, &$form_state, $form) {
  $number = $element['#value'];
  if ($error = sms_validate_number($number)) {
    foreach ($error as $lerror) {
      form_error($element, $lerror);
    }
  }
  elseif (sms_user_get_uid($number)) {
    form_error($element, t('This phone number is already registered to another user.'));
  }
}