web analytics
BlogInternet

K2 Comments Auto Notification

For Joomla 3.1.5 & K2 2.6.7 you can try this:Find the /components/com_k2/models/item.php and paste on the row 1274, immediate before the row $response->message = JText::_(‘K2_COMMENT_ADDED_REFRESHING_PAGE’); the following code:
// Email notification 
$uri = JURI::root().K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->itemAlias),$row->catid.':'.urlencode($row->catAlias)); 
$to = 'user@email.com'; 
$subject = 'New comment published!'; 
$message = 'New comment published!' . "\r\n\r\n" . 'By: '. $user->name . "\r\n" . 'Text: ' . $row->commentText . "\r\n" . 'URL of the page: ' . $uri; 
$headers = 'From: '. $user->email . "\r\n" . 
'Reply-To: '. $user->email . "\r\n" . 
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
If you use another version of K2 you should try to locate the correct place for pasting. For pity this solution is not a long term one, because when you update your K2, all the changes will be lost. But since K2 Component doesn’t offer the possibility to be notified when an user let a comment, this could  be an useful solution.k2_comments
Distribuie articolul pe:
TwitterFacebookGoogle+

      Cristian Iosub