You are here

function security_questions_form_user_register_alter in Security Questions 6

Same name and namespace in other branches
  1. 6.2 security_questions.module \security_questions_form_user_register_alter()

Implements hook_form_FORM_ID_alter() for user_register().

File

./security_questions.module, line 377
Main module file for security_questions.

Code

function security_questions_form_user_register_alter(&$form, &$form_state) {

  // Get the number of required questions the user needs to answer.
  $required = variable_get('security_questions_number_required', 3);
  $form_id = $form['#id'];

  // Build an array of variable we need to construct our form.
  $form_state['build_info'] = array(
    'args' => array(
      $account = NULL,
      $required,
      $form_id,
    ),
  );

  // Merge in our answer form.
  $form += drupal_retrieve_form('security_questions_user_answer_form', $form_state);

  // Add out validation handler.
  $form['#validate'][] = 'security_questions_user_answer_form_validate';

  // We cant add our standard submit handler here, because the user id
  // has not yet been assigned. Instead, we will get the info during
  // hook_user_insert().
  // array_push($form['#submit'], 'security_questions_user_answer_form_submit');
}