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: 10-04-2016
  Comments: 0

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:



A2 Webhosting CMS Made Simple

  Comments

  Click here to leave a comment






This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)
  « Enter the CAPTCHA code (lower case)

Your IP address will be stored on submit. I reserve the right to change or delete your response without notice!
In case of abuse your IP address will be blocked!


Can I have your attention for a moment?

Did this tutorial help you solving a problem at your (clients) website and it saved you many hours of work? Great!!
Consider buying Rolf a cup of coffee in return! [ Click here ]


  0 Comments

No comments yet...

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

Admin Login Info Mailer

  Article optimized for CMSMS 2.x

  Author:
  Last tested in: CMSMS 2.1.2
  Last updated: 10-04-2016
  Comments: 0

A2 Webhosting CMS Made Simple