By j_ten_man on
Can someone please clear this up for me. I cannot use drupal_goto in hook_user() on case login. The following is not working:
function my_module_user($op, &$edit, &$user, $category=NULL){
if($op=='login'){
drupal_goto('my/module/url');
}
}
Just to be clear, my module's name is my_module and this code is definitely getting called. How can I redirect the user to a page on login if they meet some criteria? For my module they will have a returned payment that did not go through and we need to redirect them to a certain page.
Comments
<?phpfunction
Good idea. I went about it
Good idea. I went about it in a slightly different way by setting a Session variable and then calling drupal_goto if that variable is set.
Work great!
Thanks a lot!
Most other methods do not work for me. But this.
Need to clear "destination" values before drupal_goto
Please see this comment on making drupal_goto work within hook_user: http://drupal.org/node/580144#comment-3368072
Exactly.
This was my problem, I had /user?destination=node which overrides drupal_goto() apparently.