- Posts: 3
COMMUNITY FORUM
Auto notification for new blog comments
- geoff ashton
-
Topic Author
- Offline
- New Member
Less
More
12 years 3 months ago #109025
by geoff ashton
Auto notification for new blog comments was created by geoff ashton
Can I set up an automatic notification every time I get new blog comments on my website? Currently I have to remember to go to the backend regularly just to check. It would be much easier if I'd get an email each time a post was submitted.
Thanks.
PS I'm a complete novice so please keep it simple!
Thanks.
PS I'm a complete novice so please keep it simple!
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
Less
More
- Posts: 3722
12 years 3 months ago #109026
by william white
Replied by william white on topic Re: Auto notification for new blog comments
By default the only email that will be sent is if someone reports a comment, you will find that in the paramaters of the k2 dashboard, comments tab.
K2autonotify from k2joom.com/jiliko.net will do what you want for 1.5 sites
a version for 2.5 is in the works
Im sure there will be chat about it here when its available
K2autonotify from k2joom.com/jiliko.net will do what you want for 1.5 sites
a version for 2.5 is in the works
Im sure there will be chat about it here when its available
Please Log in or Create an account to join the conversation.
- geoff ashton
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 3
12 years 3 months ago #109027
by geoff ashton
Replied by geoff ashton on topic Re: Auto notification for new blog comments
Thanks for your help - so I guess I'm stuck with remembering to check on the back end of the CMS!
Please Log in or Create an account to join the conversation.
- Kolio Kolev
-
- Offline
- New Member
Less
More
- Posts: 10
12 years 3 months ago - 12 years 3 months ago #109028
by Kolio Kolev
Replied by Kolio Kolev on topic Re: Auto notification for new blog comments
Hi Geoff,
For Joomla 2.5 & K2 2.6.2 you can try this:
Find the /components/com_k2/models/item.php and paste on the row 1225, immediate after the row echo $json->encode($response); the following code:
// Email notification
$uri = JURI::root().K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->itemAlias),$row->catid.':'.urlencode($row->catAlias));
$to = 'This email address is being protected from spambots. You need JavaScript enabled to view it.';
$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 very good, because when you update your K2, all the changes will be lost. But this is better than nothing isn't it?
:)
P.S. As a bonus in this way you can send answers directly to your customers from your e-mail client!
For Joomla 2.5 & K2 2.6.2 you can try this:
Find the /components/com_k2/models/item.php and paste on the row 1225, immediate after the row echo $json->encode($response); the following code:
// Email notification
$uri = JURI::root().K2HelperRoute::getItemRoute($row->itemID.':'.urlencode($row->itemAlias),$row->catid.':'.urlencode($row->catAlias));
$to = 'This email address is being protected from spambots. You need JavaScript enabled to view it.';
$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 very good, because when you update your K2, all the changes will be lost. But this is better than nothing isn't it?
:)
P.S. As a bonus in this way you can send answers directly to your customers from your e-mail client!
Please Log in or Create an account to join the conversation.
- geoff ashton
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 3
12 years 3 months ago #109029
by geoff ashton
Replied by geoff ashton on topic Re: Auto notification for new blog comments
Thanks for that Kolev, but I got lost after you said 'Find the....'! Haha! I think I'd better wait till an easier fix comes along - I don't want to blow my website up to bits!
Please Log in or Create an account to join the conversation.
- Kolio Kolev
-
- Offline
- New Member
Less
More
- Posts: 10
12 years 3 months ago #109030
by Kolio Kolev
Replied by Kolio Kolev on topic Re: Auto notification for new blog comments
It would be better if this functionality becomes gereric function. I'll wait for knowledgeable solution too, generic or plugin it doesn't matter.
:)
:)
Please Log in or Create an account to join the conversation.
- Juan Lopez
-
- Offline
- New Member
Less
More
- Posts: 1
12 years 3 months ago - 12 years 3 months ago #109031
by Juan Lopez
Replied by Juan Lopez on topic Re: Auto notification for new blog comments
Hi Kolev,
I tried inserting this code but it's not working.
My K2 version is 2.5.7 and Joomla! 2.5.8. any ideas why? i've attached the item.php file for reference. I placed the code in line 928.
Thanks in advance
Juan
I tried inserting this code but it's not working.
My K2 version is 2.5.7 and Joomla! 2.5.8. any ideas why? i've attached the item.php file for reference. I placed the code in line 928.
Thanks in advance
Juan
Please Log in or Create an account to join the conversation.