diff --git a/logintoboggan.module b/logintoboggan.module index ec2434d..b3aa233 100755 --- a/logintoboggan.module +++ b/logintoboggan.module @@ -890,6 +890,13 @@ function logintoboggan_unified_login_form($active_form = 'login') { 'type' => 'setting', ); $register_form = drupal_get_form('user_register_form'); + + // Adjust #action so we get the right page after a validation error. + $destination = drupal_get_destination(); + $url_options = array('query' => (($destination['destination'] != 'user/login') && ($destination['destination'] != 'user/register')) ? $destination : NULL); + $login_form['#action'] = url('user/login', $url_options); + $register_form['#action'] = url('user/register', $url_options); + $rendered_login_form = drupal_render($login_form); $rendered_register_form = drupal_render($register_form); $variables = array(