drupal_goto ignored in custom form submit handler I'm working on a site at the moment where some nodes are hidden behind a login. You can see a list of them, but to view them you need to sign in.

The sign in is done by showing the user login block in a lightbox.

Now the problem I'm having is the submit handler for the form isn't working properly. In my template.php file, it looks like this:

function fisita_redirect_after_login(&amp;$form, &amp;$form_state) {
   drupal_set_message($form['hidden_paper_url']['#value']);
   drupal_goto("http://www.google.com");
   //$form['#redirect'] = $form['hidden_paper_url']['#value'];
   //$form_state['#redirect'] = $form['hidden_paper_url']['#value'];
}


The Drupal set message, works fine, and it is outputting what I want (the URL we're trying to redirect to), but any attempt at changing the page isn't running. Either redirect or drupal_goto.

Does anyone have any clues?

Thanks
I had a problem like this and I used this as a workaround to get the page to redirect:

$url = url("node/$nid");
header("Location:$url");
drupal_set_message(t('Message to be displayed in the next page'));
drupal_exit();