How do i alter this

<?php
function user_pass_submit($form, &$form_state) {
  global $language;

  $account = $form_state['values']['account'];
  // Mail one time login URL and instructions using current language.
  _user_mail_notify('password_reset', $account, $language);
  watchdog('user', 'Password reset instructions mailed to %name at %email.', array('%name' => $account->name, '%email' => $account->mail));
  drupal_set_message(t('Further instructions have been sent to your e-mail address.'));

  $form_state['redirect'] = 'user';
  return;
}
?>

The

$form_state['redirect'] = 'user';

needs to redirect to a other path, i created my own password request template but it keeps redirecting to /user after submiting. So i need to change the form_state but i just can't figure out how...

Comments

Garrett Albright’s picture

I presume you are trying to do this with a custom module?

Perhaps try something like this:

mymodule_form_user_pass_alter(&$form, &$form_state) {
  $form['#submit'][] = 'mymodule_pass_submit';
}

mymodule_pass_submit($form, &$form_state) {
  $form_state['redirect'] = 'other-path';
}
Michsk’s picture

i would want to alter it trough template.php. I am not makeing a custom module.

Garrett Albright’s picture

I don't think there's an intelligent way to do it through the theming layer. This really is something for a module to do.

Michsk’s picture

dude your briljant! That completely did the trick. I made it into a module and now it works. If i could i would send kudos to you.

Michsk’s picture

bump... above did not do the trick.

aniket.sharma’s picture

function mymodule_form_user_pass_alter(&$form,&$form_state) {
$form['#redirect'] = 'whatever';
return;
}

nampham’s picture

Thank you, aniket.sharma. It works for me.