Form #redirect not working? I'm trying to make the user creation form redirect back to the home page when you submit it. I'm using Content Profiles so it is two forms sharing a submit button. Even if I set #redirect = '/' on both forms the form always redirects back to itself. It works and everything, but won't redirect how I want.

Any ideas?

Code:

function mymodule_form_alter(&amp;$form, $form_state, $form_id) {
      switch ($form_id) {
        case 'user_register':
        $form['#redirect'] = '/';
        break;
        case 'coordinator_node_form':
        $form['#redirect'] = '/';           
    }
}
There are two facts to keep in consideration about $form['#redirect']:


$form_state['#redirect'], set in a form submission handler, takes the precedence over $form['#redirect'].
$form['#redirect'] and $form_state['#redirect'] are ignored for forms where "#action" has been set by a module. That is what happen with the user login form.
$form['#redirect'] and $form_state['#redirect'] are ignored when $_REQUEST['destination'] is set; its value is instead used.


If you want to redirect a form, and be sure it gets redirected to the path you set, you should implement hook_form_alter() to add a form submission handler that alters $form_state['#redirect']. The module implementing that hook should be executed after other modules that alter $form_state['#redirect'] for that module.
This doesn't have any effect, though, in the last two cases I listed before.