You are here

function twitter_signin_form_alter in Twitter 6.4

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. 7.6 twitter_signin/twitter_signin.module \twitter_signin_form_alter()
  4. 7.3 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()

Implementation of hook_form_alter()

File

twitter_signin/twitter_signin.module, line 97
Hook implementations for twitter_signin module.

Code

function twitter_signin_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'twitter_oauth_callback' && 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(
      '#value' => theme('item_list', $items),
    );
  }
  elseif ($form_id == 'user_register' && isset($_SESSION['twitter']['values'])) {
    $form['name']['#default_value'] = $_SESSION['twitter']['values']['screen_name'];
    $form['auth_twitter'] = array(
      '#type' => 'hidden',
      '#value' => $_SESSION['twitter']['values']['user_id'],
    );
  }
}