Login info mailer
Posted: Sat Oct 28, 2006 7:50 pm
YES! I did it!
I created a script that is sending the login info by email to a newly created user. However, since my knowledge of PHP is very basic yet I'm sure there are some things to improve and I'm open for suggestions.
I just copied the mailer script from the install.php (since there is an option to send the CMS admin login details by email) and modified it accordingly. Here's the script to put in a user defined tag:
However, the automatic link ($link variable) isn't working yet (I commented it out for now). Does anybody have an idea?
This user defined tag must be attached to the event "AddUserPost" in the event list.
OK, I'm open for suggestions.

I just copied the mailer script from the install.php (since there is an option to send the CMS admin login details by email) and modified it accordingly. Here's the script to put in a user defined tag:
Code: Select all
//$link = str_replace(" ", "%20", $_POST['docroot']);
if (isset($_POST["email"]))
{
echo "<p>E-mailing user account information...";
$to = $_POST["email"];
$subject = 'CMS Account Information';
$message = <<<EOF
You have been added as new user to CMSmadesimple.
This is your new account information:
username: {$_POST["user"]}
password: {$_POST["password"]}
Log into the site admin here: /*$link*/ http://example.com/admin/
EOF;
echo (
@mail($to, $subject, $message)
? '[done]'
: '<strong>[failed]</strong>'
);
echo '</p>';
}
This user defined tag must be attached to the event "AddUserPost" in the event list.
OK, I'm open for suggestions.
