You are here

function userone_form_alter in User One 6

Implementation of hook_form_alter().

File

./userone.module, line 102
User One module.

Code

function userone_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {

    // Replace the core validator with useone's.
    foreach ($form['#validate'] as $key => $validator) {
      if ($validator == 'user_login_authenticate_validate') {
        $form['#validate'][$key] = 'userone_login_authenticate_validate';
        break;
      }
    }
  }
  else {
    if ($form_id == 'user_admin_account') {
      $keys = array(
        'name',
        'status',
        'roles',
        'member_for',
        'last_access',
        'operations',
      );
      foreach ($keys as $key) {
        unset($form[$key][1]);
      }
      unset($form['accounts']['#options'][1]);
    }
  }
}