Send generated password for imported users
aMember doesn't store plain text passwords, so there is no way to get password which was generated on import. However if you need to send message to all users just after import and provide login info you can do this:
Import users with generate new password option enabled. (Password doesn't really matter at this stage)
Add this code to site.php file:
Am_Di::getInstance()->hook->add(Am_Event::MAIL_SIMPLE_TEMPLATE_BEFORE_PARSE, function (Am_Event $event)
{
/* @var $tmp Am_Mail_Template */
$tmp = $event->getTemplate();
$user = Am_Di::getInstance()->userTable->load($tmp->user['user_id']);
$mailBody = $event->getBody();
if (strpos($mailBody, '%generate_pass%')) {
/* @var $user User */
$user->generatePassword();
$pass = $user->getPlaintextPass();
$user->save();
$tmp->generate_pass = $pass;
}
});
- Now when you send email message for all new users:
aMember CP -> Users -> E-Mail Users
use Advanced Search and condition Added During Import to email only just imported users. You can find import id in Import History at: aMember CP -> Users -> Import Users
you can use %generate_pass%
placeholder for password field:
login: %user.login%
password: %generate_pass%
aMember will generate new password for each user again and will replace
%generate_pass%
to new password.