I am using Drupal 7 for my website. I have two roles administrator and IT. I want to add auto generate password link at the time change the password by superadmin or IT role and also send the mail to respective user.

Please help how to add this functionality in my site.

  • Please any one suggest me Commented Aug 6, 2016 at 6:03

2 Answers 2


You can used hook_user_presave() to get the changed password in your module:

function mymodule_user_presave(&$edit, $account, $category){
 echo $_REQUEST['pass']['pass1'];

and use the functions hook_mail() & drupal_mail() to send the email in hook_user_presave() with the changed password in $_REQUEST['pass']['pass1'].

  • Hi, Brian i am new in drupal so please let me know full process Commented Aug 17, 2016 at 6:40
  • You need a custom module that uses hook_user_presave() (to intercept password), hook_mail() (to define custom email), & drupal_mail() (to send mail in mymodule_user_presave). You can Google "Drupal 7 tutorial custom module" & "Drupal 7 drupal_mail" on how to do that. There are many. Commented Aug 18, 2016 at 17:58

I have implemented this functionality using Password Quick Set module and doing a little bit of custom code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.