I am using hook_form_alter to add validation and submit handlers to the registration form:
<?php
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'user_register_form') {
$form['#validate'][] = 'blah_register_validate';
$form['#submit'][] = 'blah_register_submit';
}
}
?>
They were both working fine until I added the following hook:
<?php
function MYMODULE_user_login(&$edit, $account) {
drupal_goto('user');
}
?>
The validation function still works but the submit function gets bypassed completely - it doesn't get called at all by form_execute_handlers() in form.inc. As soon as I remove hook_user_login, it works again. Anyone have an idea why?
Update:
hook_user_login() gets called by user_login_finalize() in the User Module. Unfortunately, this happens before my submit function gets called - so obviously when I use drupal_goto() the submit function will never get called. Can anyone confirm if I am adding the submit handler correctly, is there another way?