Here is a hack to send and email to the article author when an new comment is posted.
1) Go to components/com_maxcomment and open 'maxcomment.php'
2) Find the second orrurance of '// Send notify to admin mail' - should be down around line 649
3) Once you find it, go down another 14 or 15 rows until you find
| Code: |
'$success = mosMail( $mosConfig_mailfrom, $mosConfig_sitename, $mxc_notify_email, $subject, $mailtext, 1 );'
|
4) Paste after the line above, but before the '}':
| Code: |
// Send notify to author mail
$query = "SELECT DISTINCT u.email, c.title"
."\nFROM #__mxc_comments"
."\nLEFT JOIN #__content as c"
."\nON contentid = c.id"
."\nLEFT JOIN #__users as u"
."\nON created_by = u.id"
."\nWHERE contentid = '$contentid'"
;
$database->setQuery( $query );
$rows = $database->loadObjectList();
if ( $rows ){
foreach ( $rows as $row ) {
$subject = sprintf( _MXC_AUTHORMAILSUBJECT );
$subject = stripslashes( $subject );
$mailtext = stripslashes( _MXC_AUTHORMAIL ) . "<b>" . $row->title . "</b>:";
$mailtext .= "<br /><br /><b>" . _MXC_COMMENTAUTHOR . "</b>: " . htmlspecialchars( $name, ENT_QUOTES ) . "<br />";
$mailtext .= "<b>" . _MXC_TITLE . "</b>: " . htmlspecialchars( $title, ENT_QUOTES ) . "<br />";
$mailtext .= "<b>" ._MXC_COMMENT . "</b>: " . htmlspecialchars( $comment, ENT_QUOTES );
$mailtext .= "<br /><br />" ._MXC_COMMENTTHREAD . "<br />" . "<a href=\"" . $articlelink . "\">" . $articlelink . "</a><br /><br />";
$mailtext .= _MXC_THANKS . "<br />" . _MXC_SIGNTURE . "<br /><br /><br />";
$mailtext .= stripslashes(_MXC_AUTHORMAILFOOTER);
$success = mosMail( $mosConfig_mailfrom, $mosConfig_sitename, $row->email, $subject, $mailtext, 1 );
}
}
|
5) Save file
6) Go to administrator/components/com_maxcomment/languages and open 'english.php'
7) Go to the bottom and before the '?>' add:
| Code: |
// Author Email
DEFINE("_MXC_AUTHORMAILSUBJECT","You have received a new comment on your document");
DEFINE("_MXC_AUTHORMAIL","You have received a new comment on -- ");
DEFINE("_MXC_COMMENTAUTHOR","User");
DEFINE("_MXC_COMMENTTHREAD","To see the comment thread, follow the link below:");
DEFINE("_MXC_THANKS","Thanks,");
DEFINE("_MXC_SIGNTURE","Website Team");
DEFINE("_MXC_AUTHORMAILFOOTER","Do not reply. This message was automatically generated");
|
8) Save File
This hack is tied in with the admin email notification and is turn on and off by the admin email setting. Hopefully, this functionality can be optimized and improved in the next release.
Thanks for the great comment component!