Hi,

I was jus wondering how to code a snippet that would redirect the user to the page where he logged in. For example, if my user logs in on node/180 because he would like to post a comment, I think that he should be redirected to the node/180.

Can somebody explain how to do that?

Thanks in advance!

Caroline

Comments

ardas’s picture

Interesting question...
I wonder, is it possible to login from node/180 page? Login is performed from user/login page unless you set up logintoboggan.module which has an ability to output login form on a 'no access' page. If so, you can try to use $_GET['q'] in your snippet to take current path.

Or am I missing something?

Luneh’s picture

Well, what I mean is that you can log in on every single page when using a login block. Which means that, yes, you can be reading for example node/180 page and decide to log in using the box.

On most websites you then come back to the page where you decided to log in.

ardas’s picture

I don't know at the moment:)
You can of course write something like a variable_set('ld_path', $_GET['q']) in a Redirect condition option in order to save old page path. And then read ld_path variable and redirect to that path.

But I'll think of a better solution.

ardas’s picture

btw, drupal.org behaves exactly as you described. I'm starting to think that Drupal core user.module redirects you to the page you were logging from, doesn't it? You don't need login_destination.module in this case at all.

Luneh’s picture

Hi,

You're right. I was so deep into the thinking about how to change this issue that I did not even remember that before I installed the module, Drupal was reacting as intended. I have desactivated the module and found another way to do what I wanted to do with the module.

Thanks :)

ardas’s picture

no prob :)

ardas’s picture

Status: Active » Closed (fixed)

no prob :)