G'day guys. I've written a custom authentication module, and it's working perfectly...almost. I can't figure out how to perform a redirect.

In the module, my custom auth system is triggered with this:

function m2w_form_user_login_alter(&$form, &$form_state) {
  # Make our auth system the first auth mechanism to fire.
  array_unshift($form['#validate'], 'm2w_auth_system');

  return $form;
}

function m2w_form_user_login_block_alter(&$form, $form_state)
  {return m2w_form_user_login_alter($form, $form_state);}

When m2w_auth_system() is executed, header() works, but drupal_goto() fails to redirect:
drupal_goto('http://www.google.com');

Why would drupal_goto() not work?

Thanks,
Nick

Comments

jody lynn’s picture

User_login_block sets a custom #action in the form to redirect users to the page they are already on. This could be interfering. You could try unsetting it.

You could also try using $form_state['redirect'] as described here: http://api.drupal.org/api/file/developer/topics/forms_api.html

--Zivtech--