1

I'm working on a process to prompt users to a login when clicked on a link first. For instance, if click on http://www.example.com/tester, the user will be prompted to log in. After loggin in, the user will be redirected to the current page http://www.example.com/tester.

I've tried LoginToboggan as well as Login Destination.

Login Destination should allow for "current" but it doesn't work.

Both of the modules have similar ways to do it i'm sure.

0

Check Redirect 403 to User Login

Redirect the HTTP 403 error page to the Drupal /user/login page with an optional message

0

The CustomError module allows the site admin to create custom error pages for HTTP status codes 403 (access denied) and 404 (not found), without creating nodes for each of them. Some more details about its features (from its project page):

  • Configurable page title and descriptions.
  • There are no author and date/time headers as with normal nodes.
  • Any HTML formatted text can be be put in the page body.
  • The error pages are themable.
  • Users who are not logged in and try to access an area that requires login will be redirected to the page they were trying to access after they login.
  • Allows custom redirects for 404s.

You'll probably be interested mostly in the part about "Users who are not logged in and try to access an area that requires login will be redirected to the page they were trying to access after they login.".

0

Possible duplicate

Looks like your solution lies in getting the previous URL from $_SERVER['HTTP_REFERER']); Which will get the previous page the user was on.

However the way you word it makes it sound like you want to go from example.com/a when a user clicks a link to go to example.com/b and they aren't logged in you intercept that request to login then continue on to example.com/b

In which case wouldn't it make sense to

  1. check if user logged in?
  2. if false store the url that was clicked in a cookie
  3. present the login screen you have
  4. manually set the redirect URL upon success

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.