Logging in with thickbox gives no redirection
paulnem - February 25, 2008 - 00:55
| Project: | Login Destination |
| Version: | 5.x-1.0 |
| Component: | User interface |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
Hi there
I hope this isn't too stupid of a question, however I've installed the module and if I go to user/login It will redirect for me, however with thickbox for login enabled it does not work. I am simply returned to the last page I am on, which is standar practice for thickbox login.
Is there anything I can do here, is this perhaps a thickbox login problem rather than login destination?
I'm running Drupal 5.7 with the latest Thickbox and Login Destination.
Thanks

#1
I lied. I am always returned to the front when using t hickbox.
#3
It seems this function, within thickbox is controlling where logging in users go. It doesn't seem to play nice with login_destination.
function thickbox_form_alter($form_id, &$form) {
if ($form_id == 'user_login' && arg(0) == 'thickbox_login') {
$form['#action'] = url('user/login', 'destination='. $_GET['destination']);
$form['name']['#size'] = 25;
$form['pass']['#size'] = 25;
}
So I'm really not sure at this point. I can change that destination to the page I want, but that seems like a dodgy situation to be in.
As I've already said, without thickbox, login_destination works fine.
#2
It seems this function, within thickbox is controlling where logging in users go. It doesn't seem to play nice with login_destination.
function thickbox_form_alter($form_id, &$form) {
if ($form_id == 'user_login' && arg(0) == 'thickbox_login') {
$form['#action'] = url('user/login', 'destination='. $_GET['destination']);
$form['name']['#size'] = 25;
$form['pass']['#size'] = 25;
}
So I'm really not sure at this point. I can change that destination to the page I want, but that seems like a dodgy situation to be in.
As I've already said, without thickbox, login_destination works fine.
#4
I've also requested support from the thickbox queue as I'm not sure where the problem sits.
http://drupal.org/node/228530
#5
subscribing
#6
here's an updated function thickbox_form_alter that fixes this issue... it just checks if login destination is enabled and if so defers to that module's default destination behavior. perhaps not the best way but it definitely works.:
thickbox.module (~ line 145)
function thickbox_form_alter($form_id, &$form) {if ($form_id == 'user_login' && arg(0) == 'thickbox_login') {
if (module_exists('login_destination')) {
$form['#action'] = url($_GET['q'], 'destination=login_redirect');
} else {
$form['#action'] = url('user/login', 'destination='. $_GET['destination']);
}
$form['name']['#size'] = 25;
$form['pass']['#size'] = 25;
}
}
#7
honestly i'm not sure why thickbox needs this customized redirection anyway... it doesn't serve any purpose that i can tell. maybe it would be simpler to just remove this line from thickbox_form_alter:
$form['#action'] = url('user/login', 'destination='. $_GET['destination']);and let other modules do their own thing? i cut that line out and everything seemed to work just fine.
#8
#9
I've tried the options from the other issue in the thickbox queue on my thickbox 2.0 install but there are issues when the user isn't valid, either wrong username or wrong password. it sends them to a page (rather than a thickbox) outside the theme to try again.
I've reverted (for my specific purposes) it to this :
<?phpfunction thickbox_form_alter($form_id, &$form) {
if ($form_id == 'user_login' && arg(0) == 'thickbox_login') {
$form['#action'] = url('user/login', "destination=login_redirect");
$form['name']['#size'] = 25;
$form['pass']['#size'] = 25;
}
?>
This will work with a slight change, though I don't know login_destination is big enough to make this part of thickbox.
<?phpfunction thickbox_form_alter($form_id, &$form) {
if ($form_id == 'user_login' && arg(0) == 'thickbox_login') {
if (module_exists('login_destination')) {
$form['#action'] = url('user/login', "destination=login_redirect");
} else {
$form['#action'] = url('user/login', 'destination='. $_GET['destination']);
}
$form['name']['#size'] = 25;
$form['pass']['#size'] = 25;
}
}
?>
So any other thoughts around this? Obviously a thickbox problem, but it would be nice to get it working.