You are here

function userloginbar_form_alter in UserLoginBar 7

Same name and namespace in other branches
  1. 5 userloginbar.module \userloginbar_form_alter()

Implementation of hook_form_alter().

File

./userloginbar.module, line 86

Code

function userloginbar_form_alter(&$form, $form_state, $form_id) {
  global $form_values;
  switch ($form_id) {
    case 'user_login_block':
      $destination = drupal_get_destination();
      $form['#action'] = '?q=user&destination=' . $destination['destination'];
      $form['#method'] = 'post';
      $form['form_id'] = array(
        '#type' => 'hidden',
        '#default_value' => 'user_login',
      );
      $items = array();
      if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
        $items[] = l(t('Register'), 'user/register', array(
          'attributes' => array(
            'title' => t('Create a new user account.'),
          ),
        )) . ' |  ';
      }
      $items[] = l(t('Forgot Password?'), 'user/password', array(
        'attributes' => array(
          'title' => t('Request new password via e-mail.'),
        ),
      ));
      $form['links'] = array(
        '#markup' => theme('item_list', array(
          'items' => $items,
        )),
        '#weight' => 100,
      );
      break;
  }
}