Posted by Dako on April 8, 2010 at 12:12pm
3 followers
Jump to:
| Project: | Email Registration |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | email registration |
Issue Summary
Right now the user is being redirected by LINE 125 to $form_state['redirect'] = 'user/'. $account->uid;
For example, I have other module that sets "/personal" as default user page and "/user" is disabled (with access denied there).
It would be great to be able to not interfere with other module in terms of redirect (or to be able to set "redirect url" in the admin interface).
Thanks.
Comments
#1
How about overriding the effects of all hook_form_alter() invocations by declaring a #after_build callback?
e.g. in mymodule_hook_form_alter()
$form['#after_build'][] = 'mymodule_user_register_after_build';then
/**
* Callback function using after_build on user_registration form.
*/
function mymodule_user_register_after_build($form, &$form_state) {
// Add callback to enforce redirection.
$form['#submit'][] = 'mymodule_user_register_submit';
return $form;
}
/**
* Callback function for registration form submit.
*/
function mymodule_user_register_submit($form, &$form_state) {
$form_state['redirect'] = 'mypath1/mypath2';
}
As long as no other modules have #after_build callbacks, you should be able to add your own submit function after whatever the other modules (including email_registration) have put in $form['#submit']. If your function sets $form_state['redirect'] and gets to be the last piece of code to do so, your personal redirect will be the one that is used.
I am trying to integrate FBConnect, email_registration and Content Profile with my own custom login/registration requirements, so this is a hot topic for me, but I can see that if contributed modules use this approach to override other contributed modules it becomes something of an arms race as to who gets last go at the $form variable!
#2
I commented out #125 and #124 (registration confirmation message). I use rules to direct new users to a special page and this was preventing that from happening.
An admin option would be nice or perhaps just removing all together, unless I am missing something.