By kuldeepkaundal on
Hi,
I am trying to add my own login functionlity, and for this i've added mymodule_alter in my module and it is working fine, however, i am facing an issue with user_login_block. I want my site visitors to redirect to registration page if they enter wrong credentials in login form, but unable to do so. Here's what i am trying:
if($login){
drupal_goto('homepage');
}
else{
drupal_goto('registration');
}
control comes in else condition, if i put some message here message gets printed out, but, it never redirects,stays on same page.
What can be the issue here, its working fine incase of user logn form, just doesn't work while coming from user login block.
Thanks,
Kul.
Comments
what are you passing in
what are you passing in $login?
Abhishek Sawant
Drupal Developer
$login is just a simple check
$login is just a simple check to see if credentials found in database or not.
I've tried all the ways of redirecting to new page, it simply doesn't redirect, even using header('Location') has no effect watsoever, so, i feel there must be some setting that disallows redirects for user login block.
Or is it an undoable task?
is there no way to redirect
is there no way to redirect on entering wrong credentials in case of user login block?
well, let me reply myself
well, let me reply myself once again, because the solution is:
unset($_REQUEST['destination']);
drupal_goto($url);
node?destination=node
I currently have a front page that blocks all access to the site and on incorrect login credentials the url points to node?desintation=node. Will your solution fix that? If so, how do I use this? I'm not really a programmer but if I'm pointed to a module file or function that I have to put in my own module I'll be able to figure it out, just need a starting point.
kuldeepkaundal's suggestion helped
kuldeepkaundal's suggestion helped in my case too. Here is my code which others might find helpful