How to send notification with new password to user after password change

From aMember Pro Documentation
Revision as of 06:51, 2 April 2013 by Caesar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add this code to /amember/application/configs/site.php

<?php
 
Am_Di::getInstance()->hook->add(Am_Event::SET_PASSWORD, 'siteSetPassword');
function siteSetPassword(Am_Event_SetPassword $event)
{
    $user = $event->getUser();
    $pass = $event->getPassword();
 
    $mail = Am_Di::getInstance()->mail;
 
    $mail->setFromToDefaultFrom();
    $mail->addTo($user->email, $user->getName());
    $mail->setBodyText(<<<CUT
 
Hello, {$user->getName()}
 
Your new password is {$pass}
 
CUT
        );
 
    $mail->send();
}