sliComments icon indicating copy to clipboard operation
sliComments copied to clipboard

E-Mail new comments

Open rgblogs opened this issue 12 years ago • 3 comments

Hi

Is there any way to get email notification of any new comment?

Thanks

rgblogs avatar Mar 03 '12 05:03 rgblogs

There is no way to do that in the current version but a notification system is planned for the version 1.4

jonnsl avatar Mar 08 '12 22:03 jonnsl

I would also like an email notification for new comments. Happy to see it is planned in a future release.

In the meantime I've inserted this block of code into com_slicomments/controllers/comments.raw.php on line 47.

/*

Send email notification that a new comment has been posted

*/

$to_address = "[email protected]"; $from_name = "Your Website Name"; $from_address = "[email protected]";

$subject = "Article Comment"; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: =?UTF-8?B?". base64_encode($from_name) ."?= <$from_address>\r\n"; $headers .= "Bcc: " . "\r\n" . "X-Mailer: php";

$emailContent = "

A user has posted a new comment on the yourdomain.com Website. This comment is currently pending and will not be published until it is authorised by an Administrator. Please login to the Administration area of the website and approve or delete this comment.

The details of the comment are: <UL><LI><B>User</B>: "; $emailContent .= $data['name']; /* Author's name.*/ $emailContent .= "</UL><BR><HR>

This notifcation was auto-generated by the <a href="http://www.yourdomain.com">yourdomain.com Website - If this was sent to you in error or there are any problems please email <a href="mailto:[email protected]">[email protected].<BR>

<HR>";

mail($to_address, $subject, $emailContent, $headers, "-f $from_address");

/*

End email notification block.

*/

With my limited PHP and Joomla knowledge I can only figure out how to include the Comment Author's name in the email notification. =( I hope someone finds this useful.

adamgatt avatar May 22 '12 03:05 adamgatt

A possible plugin implementation for this is in pull request #54

gquadro avatar Nov 29 '13 13:11 gquadro