When I sign in normally, I am sent to the login destination I have specified in the Login Destination ( http://drupal.org/project/login_destination ) settings. However, when I sign in with Twitter, it stays on the start page. It would be great if this worked properly.

I am also using Login Toboggan module, BTW, but I don't think it's relevant.

Comments

steinmb’s picture

Version: 6.x-3.0-beta6 » 7.x-3.x-dev
Jeremy Byrne’s picture

Per these comments in the code of twitter.pages.inc:

 * I don't much like the use of drupal_goto() here as it might
 * interfere with other modules trying to piggyback on the form
 * submission, but setting $form['redirect'] was leaving us at the
 * twitter/oauth URL.
[...]
  // redirect isn't firing - because we're using drupal_submit_form()?
  // - so adding drupal_goto() here (but not liking it).
  drupal_goto('user/' . $account->uid . '/edit/twitter');

a hack of the module seems the only option. Fortunately, it's a simple one:

function twitter_oauth_callback_form_submit(&$form, &$form_state) {
[...]
  $form['#programmed'] = FALSE;

  $form_state['redirect'] = url('user/' . $account->uid . '/edit/twitter');

+  // Check for login_destination before redirecting
+  if (function_exists('login_destination_perform_redirect')) {
+    login_destination_perform_redirect('login');
+  }

  // redirect isn't firing - because we're using drupal_submit_form()?
  // - so adding drupal_goto() here (but not liking it).
  drupal_goto('user/' . $account->uid . '/edit/twitter');
}
13rac1’s picture

Version: 7.x-3.x-dev » 7.x-5.x-dev

Set #1887810: Use the User.Module call back function for login destination as duplicate of this.

Function suggestion from that issue:

function user_login_destination() {
  $destination = drupal_get_destination();
  if ($destination['destination'] == 'user/login') {
    $destination['destination'] = 'user';
  }
  return $destination;
}
infines’s picture

The module should effectively use the Drupal API function. The Login Destination module can then be used to control the destination if user so inclines. As the Login Destination overwrites the Drupal API function which is shown in comment #3 of this issue.