Hi Everyone
Can someone tell me, how you could generate an e-mail everytime a new topic is created in the forum?
Thanks!
Joel
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi Everyone
Can someone tell me, how you could generate an e-mail everytime a new topic is created in the forum?
Thanks!
Joel
No super clean way to do this but adding this is pretty easy its just you have to edit the Forum.php file (makes upgrading harder as you can override the code).
But to do it all you would need to do is add this near the end of the postAMessage() function in forum/code/Forum.php file on about line 1011 you should currently have (make sure your using 0.2)
if($post->ParentID == 0) {
$post->TopicID = $post->ID;
// Extra write() that we can't avoid because we need to set
// $post->ID which is only created when the object is written to the
// database
$post->write();
}
You can add a piece of code inside that if to send the email
if($post->ParentID == 0) {
$post->TopicID = $post->ID;
// Extra write() that we can't avoid because we need to set
// $post->ID which is only created when the object is written to the
// database
$post->write();
// send an email
$email = new Email('enteryour@email.com', "New Forum Thread Created", "You have a new Forum Thread");
$email->send();
}
Usually for keeping track of forum posts, threads using RSS feeds are more dynamic and powerful then email.
Thanks, this works great...