You are here

function twitter_oauth_callback in Twitter 6.4

Same name and namespace in other branches
  1. 6.5 twitter.pages.inc \twitter_oauth_callback()
  2. 6.3 twitter.pages.inc \twitter_oauth_callback()
  3. 7.6 twitter.pages.inc \twitter_oauth_callback()
  4. 7.3 twitter.pages.inc \twitter_oauth_callback()
  5. 7.4 twitter.pages.inc \twitter_oauth_callback()
  6. 7.5 twitter.pages.inc \twitter_oauth_callback()

Callback to process the response from the Twitter authentication.

2 string references to 'twitter_oauth_callback'
twitter_menu in ./twitter.module
Implementation of hook_meu()
twitter_signin_form_alter in twitter_signin/twitter_signin.module
Implementation of hook_form_alter()

File

./twitter.pages.inc, line 348
Page callbacks for Twitter module.

Code

function twitter_oauth_callback(&$form_state) {
  if (isset($_GET['denied']) || empty($_GET['oauth_token'])) {
    drupal_set_message(t('The connection to Twitter failed. Please try again.'), 'error');
    global $user;
    if ($user->uid) {

      // User is logged in, was attempting to OAuth a Twitter account.
      drupal_goto('user/' . $user->uid . '/edit/twitter');
    }
    else {

      // Anonymous user, redirect to front page.
      drupal_goto('<front>');
    }
  }
  $form['#post']['oauth_token'] = $_GET['oauth_token'];
  $form['oauth_token'] = array(
    '#type' => 'hidden',
    '#default_value' => $_GET['oauth_token'],
  );
  return $form;
}