You are here

function email_registration_form_user_register_alter in Email Registration 6

Implementation of hook_form_FORMID_alter().

File

./email_registration.module, line 101
For registration process without a username

Code

function email_registration_form_user_register_alter(&$form, $form_state) {
  $name = 'email_registration_' . user_password();

  // TODO: document what this if statement is all about.
  if (isset($form['account']) && is_array($form['account'])) {
    $form['account']['name']['#type'] = 'value';
    $form['account']['name']['#value'] = $name;
    $form['account']['mail']['#title'] = t('E-mail');
  }
  else {
    $form['name']['#type'] = 'value';
    $form['name']['#value'] = $name;
    $form['mail']['#title'] = t('E-mail');
  }
  $form['#submit'][] = 'custom_email_registration_name_submit';
}