Login Destination was working great for me with version 6.x-2.1 but when I updated to 6.x-2.3 it completely stopped working. Rechecked settings, ran update php, no luck. I have it set to redirect to the site's front page after login and that's what's no longer happening. Had to revert back to 2.1, and after doing so it's working fine again.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aaront’s picture

forgot to mention - running it on drupal 6.6

Kakulash’s picture

Same here.

Running on 6.6 as well

Eidolon Night’s picture

Agreed, not working in Drupal 6.2 either.

piersg’s picture

Ah so that's why it's stopped working - had tried all sorts, disabling other modules, re-installing. I'll roll back to 2.1... all working again. On drupal 6.6.

toddwoof’s picture

6.x-2.3 doesn't work in 6.7, either -- or, at least not on my site. I also reverted to 2.1.

Any ideas on this? Seems strange that it would simply not work, since presumably people are using it -- so I'm wondering if there is some known conflict, or some type of conflict that I should be looking for in my site in particular. Thanks!

thulstrup’s picture

I had the same problem with 6.x-2.3.
Unchecking the "Preserve destination" checkbox fixed the problem.

rjb’s picture

The solution at #6 works for me. Thanks for posting!

toddwoof’s picture

Solution in #6 does not work on my site.

Details: I have pages where you need to log in to sign up for an event, or post something. I want to show a block that says "you need to login first," with a link to login; and I want the user to return to the same page they were on, so they don't have to navigate back to the page to continue.

In 6.x-2.1 I can use the solution here: http://drupal.org/node/225890 (see comment #7) and it works perfectly.
In 6.x-2.3 it fails, whether or not "preserve destination" is checked, and instead the user is sent to the user page.

taldy’s picture

We tested this on Drupal 6.8 and everything works correctly.

1. Could it be a conflict with any of your modules?

2. Be sure destination attribute is set in the URL when you are visiting the login page.

mbiddlecombe’s picture

could you give a bit more detail about point 2? how do you set destination attribute

Tobias Weibel’s picture

Hi

I do have the same problem here. Solution #6 works for me.

Installation:
Drupal 6.9

Modules:
- ACL 6.x-1.0-beta4
- Advanced help 6.x-1.1
- Backup and Migrate 6.x-1.2
- Calendar 6.x-2.0-rc6
- CAPTCHA 6.x-1.x-dev (2008-Nov-21)
- Content Construction Kit (CCK) 6.x-2.1
- Content Access 6.x-1.0
- Date 6.x-2.0-rc6
- Email Field 6.x-1.1
- Image 6.x-1.0-alpha4
- Image Assist 6.x-2.0-alpha2
- Login Destination 6.x-2.3
- Poormanscron 6.x-1.x-dev (2008-Dez-29)
- Role Delegation 6.x-1.0
- SpamSpan filter 6.x-1.2
- Token 6.x-1.11
- Upload path 6.x-1.0
- User Read-Only 6.x-1.x-dev (2008-Sep-17)
- User Protect 6.x-1.2
- Views 6.x-2.2
- Wysiwyg API 6.x-0.5

Tobias

kinderpera’s picture

same problem; anyway solution #6 works here

mkruisselbrink’s picture

same problem here. the problem seems to be in the following code in login_destination_apply_redirect():

  if ($_GET['destination'] != $_GET['q'] && variable_get('ld_destination', TRUE)) {
    return FALSE;
  }

This will always return false if no destination is set, and thus no redirection to the proper login destination will take place.

svdoord’s picture

I think mkruisselbrink (#13) is right. In the previous revision of login_destination.module, it said:

if (!empty($_GET['destination']) && variable_get('ld_destination', TRUE)) {

I can understand why there is now a check that the destination must be different than the current page, but I think the !empty check should still be there...

In other words, I think the line should read:

if (!empty($_GET['destination']) && $_GET['destination'] != $_GET['q'] && variable_get('ld_destination', TRUE)) {
eojthebrave’s picture

Status: Active » Needs review
FileSize
756 bytes

@svdoord's code from #14 does the trick for me. Here's a simple patch that implements the fix.

davemybes’s picture

Status: Needs review » Reviewed & tested by the community

+1 for this patch. Works in D6.12. The module simply does not work without this patch.

psynaptic’s picture

I found this module was not redirecting at all. I ended up using Rules module:

http://drupal.org/node/298506

rgraves’s picture

I applied the patch from #14, but it did not work. Here's what I'm doing:

Preserve destination: checked
PHP Snippet: checked
URL: return "http://". $_SERVER['HTTP_HOST'];

I suspect it's because I'm using a full URL instead of a path without the domain.

I use this code because my login page is under https and before I installed Login Destination, it was always redirecting to my homepage to https://www.mydomain.com. Then publishers were inserting URLs in their pages with the https instead of http. It wasn't a huge problem, but I didn't want them doing that. This code worked in Drupal 5, but not in Drupal 6.12.

Is there another way I can accomplish redirecting to and http version of my homepage?

davemybes’s picture

You can try using Secure Pages module: http://drupal.org/project/securepages.

mckeen_greg’s picture

The Patch in #15 works for me. :)

Francewhoa’s picture

Related issue and module maintainer reply: http://drupal.org/node/292006#comment-970509

agerson’s picture

Yes, #15 works.

chrisck’s picture

#6 worked for me too.

rsvelko’s picture

please try if this issue is reolved with 2.5

mark it as fixed if it IS fixed.

rsvelko’s picture

Status: Reviewed & tested by the community » Fixed

if not fixed - change it back to active... I guess it is fixed now.

Francewhoa’s picture

Confirming that 6.x-2.5 works.

Thanks rsvelko

toddwoof’s picture

6.x-2.5 does not work for me.

In 6.x-2.1 I can send a user back the page they were on.

Has anyone successfully used 6.x-2.5 to send someone back to the same page they were on; and if so, would you be willing to post exactly what goes in each box of the Login Destination settings page? Thanks!

Francewhoa’s picture

@toddwoof: Find attached settings screenshot. With this settings when users log-in they are redirect to a specific URL. Could be any URL. Such as <front> for front page or node/category/page-title-here.

For example node/category/page-title-here would redirect to http://your-domain-name-here.com/node/category/page-title-here

Francewhoa’s picture

FileSize
68.09 KB

Attaching screenshot.

toddwoof’s picture

Maybe I'm missing something, or didn't describe the need properly.

I don't want to redirect the user to a specific page. I want to redirect them to whatever page they were on when they logged in. If they're on the home page and they log in, I want to redirect them to the home page. If they're on some event listing page and they log in, I want to redirect them to the event page they were on; and so on.

The purpose is to allow the user to log in and not lose their place. Sometimes they want to log in to register for an event, for example. I don't want them to log in, and then have to navigate back to the event page; I want them to be redirected right where they were.

So, a fixed url won't work.

jeremycaldwell’s picture

Same here. I have a login link on the bottom of my forum topics and when a user clicks the link to login I'd like them to be redirected back to the forum post so they can join the conversation. Any help doing that would be great.

eojthebrave’s picture

One option would be to add a ?destination parameter to your login link. So the URL is something like user/login?destination=node/678 where "node/678" is the URL of the page the user is currently on. Then make sure Login Destination is configured to support the ?destination parameter.

Francewhoa’s picture

@toddwoof: Thanks for clarifying. Indeed setting in comment #29 is for a redirecting user to a specific page. This is not what you want.

The ?destination parameter is able to do that. But I never tried that with Login Destination (LD). According to LD readme.txt file the LD support ?destination parameter.

Turn on "Preserve destination" feature to make module sensible to destination parameter.
When login from the path with specified destination (ex: 'any-page?destination=node/18')
you will be taken to node/18 instead of the URL specified in login_destination settings.

$_SESSION['login_page'] was added and stores the page you were before clicking login form button.
You can use it to determine the page you logged from instead of $_GET['q'] because $_GET['q']
always equals to 'login_redirect'.

toddwoof’s picture

...Which brings us back around to the issue noted in #8, above -- namely, it doesn't work.

@eternalistic: My solution for now is to stick with 6.x-2.1, and to use the solution in #7 on http://drupal.org/node/225890

But of course I'd like to be able to upgrade to the current version, which is why I'm asking what needs to be done for it to work in 6.x-2.5. Evidently something changed; but I can't figure it out.

Francewhoa’s picture

Status: Fixed » Needs work

Changing status to 'needs work'. Read more at comment #8 http://drupal.org/node/341683#comment-1177305

Any volunteer to provide a patch?

I would be happy to contribute testing.

Sborsody’s picture

Subscribe.

I'm trying to achieve the same as what is written in #30.

Sborsody’s picture

I followed the LD configuration instructions here and this is working for me now with 6.x-2.5: http://www.interworksinc.com/blogs/scorrales/2009/07/23/taking-control-y...

This seems like the only way to get LD to support the ?destination parameter.

Francewhoa’s picture

Version: 6.x-2.3 » 6.x-2.x-dev
Status: Needs work » Needs review
FileSize
2.15 KB

Thanks for the instructions Sborsody.

I have updated the module README.txt file. Patch attached below. Any volunteer to test this patch?

Patch is against 6.x-2.x-dev 2009-Oct-23

Apply this .patch from the module root directory /sites/all/modules/login_destination

rsvelko’s picture

I see that the main use case is "return users to where they were". I maintain the module since not very long.

My first task is to cover this use case with minimum clicks in the UI and then rethink the UI...

PS. We are merging LD into LoginToboggan for 7.x.

This is it for tonight.

rsvelko’s picture

Thanks for the README patch - it helped with the testing of the module.

I began and am almost finnished with a complete rewrite of the important parts. Everything is there but the code style can be a lot better and there are indeed some logical errors. I fixed the UX errors too. (UX = user experience - mainly in the admin UI of the module)

So stay tuned and let's hope that 2.6 (or 3.0) will be the release that works everytime.

rsvelko’s picture

Status: Needs review » Fixed

in the 2.6 version it is either / or:
- either the return-user to where they were
- or use-php-snippet / static

see the UI of LD for examples / notes.

Cheers.

I have tested this in 2.6. and all php snippets work.

The only thing that does not is the return-back on the /user page - I provided a tutorial on the project page for this (until I semi-automate it.)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.