You are here

function twitter_signin_form_alter in Twitter 7.3

Same name and namespace in other branches
  1. 6.5 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  2. 6.3 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  3. 6.4 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  4. 7.6 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  5. 7.4 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  6. 7.5 twitter_signin/twitter_signin.module \twitter_signin_form_alter()

Implements hook_form_alter().

File

twitter_signin/twitter_signin.module, line 95

Code

function twitter_signin_form_alter(&$form, $form_state, $form_id) {

  // This only applies if we've got OAuth / signin enabled.
  if (!_twitter_use_oauth()) {
    return;
  }
  if ($form_id == 'twitter_oauth_callback_form' && isset($_SESSION['twitter_oauth']['signin'])) {
    $form['#submit'] = array_merge(array(
      'twitter_signin_oauth_callback_submit',
    ), $form['#submit']);
  }
  if ($form_id == 'user_login' || $form_id == 'user_login_block') {
    $items = array();
    $items[] = twitter_signin_button();
    $form['twitter_signin'] = array(
      '#markup' => theme('item_list', array(
        'items' => $items,
      )),
    );
  }
  elseif ($form_id == 'user_register_form' && isset($_SESSION['twitter']['values'])) {
    $form['account']['name']['#default_value'] = $_SESSION['twitter']['values']['screen_name'];
    $form['auth_twitter'] = array(
      '#type' => 'hidden',
      '#value' => $_SESSION['twitter']['values']['user_id'],
    );
  }
}