Admin Login Info MailerPrevious article Next article
A simple mailing script based on the existing CMSMS mailer module, to send the newly added admin user's login info to his/her e-mail.
This article originates from the former CMSMS Wiki, the original author is 10010110.
Create a new user defined tag: Extensions >> User Defined Tags
Paste the following code into the textarea:
$website_url = $config['root_url'];
$admin_url = $website_url . "/". $config['admin_dir'];
$to = $_POST["email"];
$subject = "CMS Made Simple Account Information";
$message = "You have been added as new admin user to the CMS at " . $website_url . "\r";
$message .= "This is your new account information: \r";
$message .= "Username: " . $_POST["user"] . "\r";
$message .= "Password: " . $_POST["password"] . "\r";
$message .= "Log into the site admin here: " . $admin_url;
echo "<p>E-mailing user account information…";
echo ( @mail($to, $subject, $message) ? '[done]' : '<strong>[failed]</strong>' );
/* put mention into the admin log */
audit('','mail_login_info UDT','Automaticly mailed login info from ' . $_POST["user"] . ' to '. $_POST["email"]);
Save the tag and go to the Events section: Extensions >> Event Manager
Click the event "AddUserPost"
Select your newly created tag from the dropdown box at the end of the page and click "Add"
Now everytime a new user is added through the Admin Console, the user gets the login info sent (of course only if you also filled in the e-mail address in the user data). You can change the message subject to your liking.
No comments yet...