-
- 56 Posts
i have a blog setup where a web user can log in using webloginpe. they create a blog entry using newspublisher that gets created unpublished. from the manager end, i moderate the post and the publish it. i would like to set it up where an email is sent to the author when the document is published. i assume that a plugin would be the way to go, but i don’t know where to begin. any suggestions??
-
- 56 Posts
well, here is what i have so far.
$e = &$modx->Event;
switch ($e->name) {
case "OnDocPublished":
$Name = "Indieophile"; //senders name
$email = "[email protected]"; //senders e-mail adress
$recipient = $modx->documentObject['createdby:userinfo=`email`']; //recipient
$mail_body = $_SESSION['webFullname']. " , your post has been published. See it at http://www.indieophile.com."; //mail body
$subject = "your post has been published"; //subject
$header = "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
mail($recipient, $subject, $mail_body, $header); //mail command
break;
case "OnWebLogout":
// code here
break;
//case "":
// code here
// break;
default: "";
return;
}
and it doesn’t work. i have the onDocPublished event checked in the system events tab.
i think the problem is with using phx
$recipient = $modx->documentObject['createdby:userinfo=`email`']
any ideas??