I’ve taken over the coding side of a site from a previous MODx developer and forum member Rachel Black, who sadly died earlier this year.
There is a plugin that sends an email and writes two event log entries when a web user is changed from blocked to unblocked.
It works fine in Firefox 2 on an XP SP2 machine and Firefox 3 on a Mac, but in Safari & IE7 no email or log entry.
Can anyone think of an explanation?
The code is below and the plugin is set to run on
System Events => OnWUsrFormSave
$e = &$modx->Event;
$p = print_r($_POST, true);
if ($e->name == 'OnWUsrFormSave') {
$wasBlocked = $_POST['blockedmode'];
$blocked = $_POST['blocked'];
if ($wasBlocked && !$blocked) {
$modx->logEvent(1,3,"$p", 'OnWUsrFormSave - Send Email');
$link = $this->config['site_url'].'index.php?id=281';
$message = $modx->getChunk('RegisteredEmail');
$message = str_replace("[+name+]", $_POST['fullname'], $message);
$message = str_replace("[+group+]", $_POST['group'], $message);
$message = str_replace("[+link+]", $link, $message);
$to = $_POST['email'];
$subject = "$site_name Website registration";
$sender = $modx->config['emailsender'];
include_once $modx->config['filemanager_path'].'manager/includes/controls/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $sender;
$mail->FromName = $modx->config['site_name'];
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AddAddress($to);
$mail->send();
$modx->logEvent(1,3,"$to, $subject, $message, $sender", "Email");
}
}