I have searched extensively throughout Drupal, and have repeatedly come across a number of different issues and solutions surrounding the redirection of users following login/registration. I have not however been able to find anything that solves my particular problem. I need to be able to code (I am not a coder and don't know much about php - however I think the answer lies in php) script or enable a module that will make it possible to redirect users after login/registration to a different page. The main problem is that I need a user that login from node/10 to be redirected to node/15 following login/registration - I have a number of different pages in which this would be the case for example node 20 redirected to node 25 - node 30 redirected to node 35 ect. I have tried both the logintobbagon and the login destination modules - however neither does exactly what I require. Login destination - seems to be the best - however I can only list the urls/nodes in which the login originated from - resulting in the redirection to a static page. There is the option to insert php code - however I don't know how to write it. Could somebody please help me write the php code to place into the url destination settings section of the login destination module - so that I can redirect users to certain pages following the login from the pages listed in redirection conditions setting box. I would really appreciate some help in this matter.
Please let me know if you need more information.
Comments
also interested in this
also interested in this
If you post this as a
If you post this as a support request in the login destination module you may get some help quicker
Module 'Login Destination'
The module 'Login Destination' can do this: http://drupal.org/project/login_destination
Location Destination Not Working
Location Destination module was not working for me. What I did was change the User Module's redirect from the default Drupal install. In the file /modules/user/user.modules , I changed this line of code on line 645
To This
For example, my url is http://localhost/drupal6/welcome using clean url. If I was not using clean url, my url would be http://localhost/drupal6/?q=welcome.
So I would change to code to this '#action' => url('welcome'), and not using clean url it would be '#action' => url('?q=welcome'),
in order to avoid
in order to avoid maintaining a hacked user.module, you might want to look at the http://drupal.org/project/workflow_ng module.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
form_FORM_ID_alter()
This would be a better choice than hacking the user module.
Thanks for Playing
I was exploring login
I was exploring login redirect myself and wonder why do we need a module for it, can't we just implement hook_user to redirect a user to whatever page we want.
In your module, add something like that. Add your own logic (e.g. check $user) to set your destination if necessary:
The drupal_goto won't work
The drupal_goto won't work since drupal_goto is checking if destination is set first, and it is set by the login form.
You should set the $_REQUEST['destination'] instead.
----
/Mike
Owner of Absolutely Free Pictures
Use Front Page
I was very frustrated by this when I first started with Drupal as well. The only way that worked for me was to use the Front Page module. You can redirect people by their role as well which was very useful.
ERROR AFTER DOING THIS
#action' => url($_GET['q'], array('query' => drupal_get_destination())),
To This
'#action' => url('INSERT YOUR URL'),
For example, my url is http://localhost/drupal6/welcome using clean url. If I was not using clean url, my url would be http://localhost/drupal6/?q=welcome.
So I would change to code to this '#action' => url('welcome'), and not using clean url it would be '#action' => url('?q=welcome'),
Parse error: parse error in C:\xampp\htdocs\drupal\modules\user\user.module on line 659