Drupal hook_user reset

I need a user hook that sends password reset events.

I created a very simple module to do this - but it doesn't work.

I think this is because user_pass_reset() calls drupal_goto() after a login link is used - and that this bypasses my extra form handler.

and according to

http://www.advomatic.com/blogs/marco-carbone/drupal-privacy-configuring-...

form_alter on 'user_pass_reset' doesn't work reliably, due to how the one-time login form is implemented

<?php
function userresethook_form_alter(&$form, &$form_state, $form_id){
  if (
$form_id == 'user_pass_reset'){
   
$form['#submit'][] = 'userresethook_submit';
  } else {
    return;
  }
}

//This doesn't get called!
function userresethook_submit($form, &$form_state){
  global
$user;
 
user_module_invoke('reset', $form, $user);
}
?>

This is a shame as this could be a useful hook and I prefer not to patch the user module (which is what I've done for the time being).

Am I missing something? Is my code wrong? Is there a better way...

Tags

Post new comment

Got something to add - just enter a comment
all other fields are optional.

Your email address will not be published.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image without spaces, also respect upper and lower case.