Redirection stops working in latest version

aaront - December 2, 2008 - 17:29
Project:Login Destination
Version:6.x-2.3
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:needs work
Description

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.

#1

aaront - December 2, 2008 - 20:20

forgot to mention - running it on drupal 6.6

#2

Kakulash - December 2, 2008 - 21:02

Same here.

Running on 6.6 as well

#3

Eidolon Night - December 5, 2008 - 20:20

Agreed, not working in Drupal 6.2 either.

#4

piersg - December 6, 2008 - 21:52

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.

#5

toddwoof - December 18, 2008 - 15:18

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!

#6

thulstrup - December 20, 2008 - 11:38

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

#7

rjb - December 25, 2008 - 21:47

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

#8

toddwoof - December 31, 2008 - 14:28

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.

#9

taldy - January 13, 2009 - 15:36

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.

#10

mbiddlecombe - January 13, 2009 - 16:54

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

#11

Tobias Weibel - February 7, 2009 - 21:35

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

#12

kinderpera - March 16, 2009 - 15:20

same problem; anyway solution #6 works here

#13

mkruisselbrink - March 26, 2009 - 20:28

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

<?php
 
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.

#14

svdoord - April 2, 2009 - 11:51

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

<?php
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:

<?php
if (!empty($_GET['destination']) && $_GET['destination'] != $_GET['q'] && variable_get('ld_destination', TRUE)) {
?>

#15

eojthebrave - April 21, 2009 - 15:00
Status:active» needs review

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

AttachmentSize
341683-15-eojthebrave_destination_not_set.patch 756 bytes

#16

incrn8 - June 2, 2009 - 02:33
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.

#17

psynaptic - June 3, 2009 - 10:48

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

http://drupal.org/node/298506

#18

rgraves - June 11, 2009 - 18:48

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?

#19

incrn8 - June 12, 2009 - 03:17

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

#20

mckeen_greg - June 17, 2009 - 13:52

The Patch in #15 works for me. :)

#21

Onopoc - June 17, 2009 - 19:49

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

#22

agerson - June 22, 2009 - 04:21

Yes, #15 works.

#23

kitemedia - October 1, 2009 - 23:21

#6 worked for me too.

#24

rsvelko - October 21, 2009 - 11:47

please try if this issue is reolved with 2.5

mark it as fixed if it IS fixed.

#25

rsvelko - October 21, 2009 - 12:14
Status:reviewed & tested by the community» fixed

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

#26

Onopoc - October 22, 2009 - 14:46

Confirming that 6.x-2.5 works.

Thanks rsvelko

#27

toddwoof - October 26, 2009 - 18:03

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!

#28

Onopoc - October 27, 2009 - 02:50

@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

#29

Onopoc - October 27, 2009 - 02:39

Attaching screenshot.

AttachmentSize
ld-settings.png 68.09 KB

#30

toddwoof - October 27, 2009 - 15:45

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.

#31

eternalistic - October 28, 2009 - 00:27

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.

#32

eojthebrave - October 28, 2009 - 15:49

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.

#33

Onopoc - October 29, 2009 - 18:27

@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'.

#34

toddwoof - October 29, 2009 - 20:29

...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.

#35

Onopoc - November 2, 2009 - 22:40
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.

#36

Sborsody - November 9, 2009 - 20:42

Subscribe.

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

#37

Sborsody - November 9, 2009 - 23:30

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.

 
 

Drupal is a registered trademark of Dries Buytaert.