Posted by humblecat on July 26, 2012 at 3:57pm
how to add a redirection after user's password change without modifying Drupal Core? (user_profile_form_submit)
how to add a redirection after user's password change without modifying Drupal Core? (user_profile_form_submit)
Comments
You can add your own submit
You can add your own submit handler to the form using hook_form_alter, and set your redirect here.
Ex:
<?php
function my_module_form_alter(&$form, &$form_state, $form_id)
{
if($form_id == 'user_profile_form')
{
$form['#submit'][] = 'my_module_profile_form_submit';
}
}
function my_module_profile_form_submit($form, &$form_state)
{
$form_state['redirect'] = 'some/path';
}
?>
Jaypan We build websites
thanks
thanks. I did it last time as you said, sometimes it works not as I expect; no clue.
Thanks,
for me it work great.
Worked Great
I was reading some other post's which indicated I should be using
$form['actions']['submit']['#submit'][] = 'custom_function'
for the redirect but the content was not being saved. The redirect was happening but the new/altered data was lost. The above worked great.
Thanks