Admin Login Info Mailer

  Previous article Next article  

Admin Login Info Mailer

  Article optimized for CMSMS 2.x

  Author:
  Last tested in: CMSMS 2.1.2
  Last updated: 18-11-2017
  Comments: 0
  http://cms.ms/3OE1

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:

mail_login_info
$config = cmsms()->GetConfig();
$website_url = $config['root_url'];
$admin_url = $website_url . "/". $config['admin_dir'];

if (isset($_POST["email"]))
{
  $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>' );
  echo "</p>";
   
  /* 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.

Show related articles:





CMS Made Simple 2.2.5 - Tutorials, tips and tricks - CMSMS 2.2.5

Admin Login Info Mailer

  Article optimized for CMSMS 2.x

  Author:
  Last tested in: CMSMS 2.1.2
  Last updated: 18-11-2017
  Comments: 0
  http://cms.ms/3OE1