I'm not sure if this is a bug or if I'm using the module incorrectly, but every time I try the module all it does is place the user back at their user profile page.

As a preface, I'm also using LoginToboggan, but I have not filled in any of the LoginToboggan options to redirect users on login, and I do not have the "two emails" option selected (as I have read elsewhere was a conflict for some people in the past).

My request is really simple: we have a custom login block on every page of our site, and all I want to do is allow a user to be redirected right back to the same page they were located when the sign in took place. Therefore if a user is on node/125 and logging in, after log in they should be right back on node/125.

First I tried this code in Login Destination:

$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {
  $pageURL .= "s";
}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;

then I tried this code ...

$referrer = strtolower($_SERVER["HTTP_REFERER"]);
return $referrer;

and then I wanted to try something *really* simple so I took the code from the main page of the module description ...

global $user;
if ($user->uid == 1) {
  // Redirect the Administrator
  return 'admin';
} elseif ($user->uid == 2) {
  // Redirect the Site Owner to the 'create content' page
  return 'node/add';
} else {
  return 'node';
}

Absolutely nothing. None of them worked. We're running Drupal 5.7, PHP 5.2.3, Apache 2.2.8, MySQL 5.0.45 and as I mentioned above we have LoginToboggan 5.x-1.2, a custom login block, and Login Destination 5.x-1.0. Any advice or suggestions would be appreciated.

Comments

sgdev’s picture

Status: Active » Closed (fixed)

Well a bit more of testing and I figured it out. Our original developer created the custom login block with a form action pointing to /web/user. I looked at the login page in Drupal and I see the form action is /web/user?destination=login_redirect. As soon as I changed the custom login block to have a form action of /web/user?destination=login_redirect, Login Destination started to work.