Hello,
I had tested and verified that drupal_goto("valid-page") works from the 'login' case of my custom 'hook_user' module. It now fails silently with no errors in the log. I have a custom php page that I include in a block that I tested by copying and pasting the 'drupal_goto' line exactly, and it works fine from there. I know that some security updates were recently applied. Could that be the problem? If so, is there a work-around. I am trying to redirect certain users to a Pay Now page before assigning them the proper role. They are only users who meet the criteria in an external db, so it is not something that I can do for all authenticated users.
I have also made sure I have no extra spaces at the end of the files in my module and even removed the ending ?> (as I have seen recommended). That does not fix the problem, even though there is no reason to think that extra space is causing the problem since there is nothing in the logs.
Thanks,
Diana
Comments
Not sure if there were
Not sure if there were security issues or not, but maybe use hook_form_alter() instead..?
<?php
function hook_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_login':
case 'user_login_block':
$form['#submit'][] = 'mymodule_user_login_submit';
break;
}
}
function mymodule_user_login_submit($form, &$form_state) {
$form_state['redirect'] = 'path/to/redirect';
}
?>
I think you might even be able to just set the
#redirectattribute on the form itself in your form_alter but I haven't tried that.<?phpfunction hook_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'user_login':
case 'user_login_block':
$form['#redirect'] = 'path/to/redirect';
break;
}
}
?>
Hope that helps. :)
I have the same problem. And
I have the same problem. And i tested drupal_goto() fails on:
<?phpheader('Location: '. $url, TRUE, $http_response_code);
?>
version of drupal is 6.15
there is no errors in logs, and no any output on the page. if we put echo('test'); before header function on the page we will see 'test'. that's mean that the running of code riched the header function and it is fail even if $url is set right.