- Posts: 27
COMMUNITY FORUM
Notification of new comments by email
- dirk80
-
Topic Author
- Offline
- Junior Member
I am using the comments with k2 and enable the approved option for them. But I don't want to watch out for new comments every day. Is it possible to set up an email notification for new comments?
Thx.
Dirk
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
Please Log in or Create an account to join the conversation.
- Mizael FAUCON
-
- Offline
- New Member
- Posts: 9
Please Log in or Create an account to join the conversation.
- Kurniawan Subiantoro
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- Jason Edwards
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- Zonegig Design, LLC
-
- Offline
- Junior Member
- Posts: 35
I hope this is not asking too much.
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
I'm trying your code modification and it works as I did receive an email notification for new comment awaiting approval.
However, in the email notification, under === Contributor ===, it's showing the email address that I entered in the config for where to send this notification email. I was expecting to see the email address of the person leaving the comment.
Also, probably not necessary but you could also include the title of the item for which the comment was added. If it's not easy to do that, don't worry about it as all we have to do is go into the comments admin and quickly filter the unpublished comments.
Mike
Please Log in or Create an account to join the conversation.
- Zonegig Design, LLC
-
- Offline
- Junior Member
- Posts: 35
Mike C said:Hi John, I'm trying your code modification and it works as I did receive an email notification for new comment awaiting approval.
However, in the email notification, under === Contributor ===, it's showing the email address that I entered in the config for where to send this notification email. I was expecting to see the email address of the person leaving the comment.
Also, probably not necessary but you could also include the title of the item for which the comment was added. If it's not easy to do that, don't worry about it as all we have to do is go into the comments admin and quickly filter the unpublished comments.
Mike
Please Log in or Create an account to join the conversation.
- Annie Jackson
-
- Offline
- New Member
- Posts: 9
John Hooley said:Okay guys, I've added a little bit more to the modifications and fixed the error with the submitter's email. It will now send an email --if there is an email entered in the parameters field-- that will either notify of a new comment that has been added or one that needs to be reviewed. It also includes the title of the item that was commented.
I changed the file location so that people will download the latest version:
bluebridgedev.com/files/k2CommentsMod.zip
The directions are the same. If you're just updating from the last change, you need only switch out item.php.
One thing I forgot to mention before, I make use of the private keyword which is available only in PHP 5+. PHP 4 users will need to remove it from the function definitions or it will cause errors.
I've also given the snippet it's own page on my site:
bluebridgedev.com/code-snippets
Please Log in or Create an account to join the conversation.
- September Coll
-
- Offline
- New Member
- Posts: 1
John Hooley said:Hey Everybody,I made some small modifications to two files in the K2 structure to accomplish this. It adds a field to the comments area of the K2 Parameters, "New comment notification email." When a new comment is added and needs to be approved, it will send an email to that address with the email of the person commenting and the comment.Instructions:1. Download the zip at bluebridgedev.com/files/k2modelMod.zip and extract config.xml and item.php2. Back-up and replace the following files:yourwebsiteroot/administrator/components/com_k2/config.xmlyourwebsiteroot/components/com_k2/models/item.php3. Login to your site's backend and go to the K2 component.4. Select parameters from the toolbar.5. Scroll down to the comments section and enter the email address to be notified.6. Test!The areas modified from the old files:-New line added at 162 of config.xml-New line on 651 of item.php and three new functions from 657 to 688Hope this helps,John
Please Log in or Create an account to join the conversation.
- xbow
-
- Offline
- New Member
- Posts: 9
Annie Jackson said:John is there any way for the author of the article to receive notifications also? I have 10 authors on my site and currently I can not find a comment system which notifies them by default that they have new comments which means there are many articles with comments from users and no replies from the author. JComments claims this is in an upcoming version but I read that 2 months ago and there are no indications of when that new version will be. If K2 can do this I will convert the whole site just for this feature. John Hooley said:Okay guys, I've added a little bit more to the modifications and fixed the error with the submitter's email. It will now send an email --if there is an email entered in the parameters field-- that will either notify of a new comment that has been added or one that needs to be reviewed. It also includes the title of the item that was commented. I changed the file location so that people will download the latest version: bluebridgedev.com/files/k2CommentsMod.zip
The directions are the same. If you're just updating from the last change, you need only switch out item.php.
One thing I forgot to mention before, I make use of the private keyword which is available only in PHP 5+. PHP 4 users will need to remove it from the function definitions or it will cause errors.
I've also given the snippet it's own page on my site:
bluebridgedev.com/code-snippets
Please Log in or Create an account to join the conversation.
- John Hooley
-
- Offline
- New Member
- Posts: 1
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
After I upgraded, it overwrote that file so the functionality is now lost....
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
Please Log in or Create an account to join the conversation.
- Simon Wells
-
- Offline
- Platinum Member
- Posts: 955
Mike C said:I opened the files in a compare tool and they're vastly different, so I'm going to undo it. Will there be an update for K2 2.2 of this comment notification functionality?
Please Log in or Create an account to join the conversation.
- Mike C
-
- Offline
- Senior Member
- Posts: 49
Please Log in or Create an account to join the conversation.
- Simon Wells
-
- Offline
- Platinum Member
- Posts: 955
The changes to the xml is just to setup what is displayed in the k2 parameters.
For item.php, there are many changes but for test purposes, we did a straight like for like swap of these two files, exactly as previously mentioned.
I just checked the files on the server and we are running to V2.1 version then posted a commented and it was mailed.
I then exchanged it for the v2.2, posted a comment and no notification.
I have updated the V2.2 file with the auto notification and have tested it this morning.
Attached is the zip with the 2 new files and a help file.
Let me know how you get on.
Mike C said:Hi Simon, how did you test it? You can't just overwrite item.php and config.xml because there's a lot of stuff that changed between versions 2.1 and 2.2. In other words, how did you move the notification code fragments from the old to the new without messing up the versions of those files?
Please Log in or Create an account to join the conversation.
- Omar Ramos
-
- Offline
- Junior Member
- Posts: 30
Yesterday afternoon I was rereading this thread and noticed that nobody had really answered the question about author notifications or notifications for reply to a post so I added in that functionality (I took K2Joom's latest 1.1 file and added the additional methods required).
In trying to test this I also across another issue where a user that is assigned to a few specific categories is then unable to comment in other categories (for permissions it's more likely that you want them to only create/edit items in those categories but you don't necessarily want to limit users to only adding comments in those few categories) so I also added the option in backend user group creation for a "Post to All Categories" permission and have included it in the zip file attached.
More on that particular issue can be found here:
The notifications for authors and commenters (and the admin notification) all seem to be working well on my end.
K2Joom said:Hi Mike, The changes to the xml is just to setup what is displayed in the k2 parameters.
For item.php, there are many changes but for test purposes, we did a straight like for like swap of these two files, exactly as previously mentioned.
I just checked the files on the server and we are running to V2.1 version then posted a commented and it was mailed.
I then exchanged it for the v2.2, posted a comment and no notification.
I have updated the V2.2 file with the auto notification and have tested it this morning.
Attached is the zip with the 2 new files and a help file.
Let me know how you get on.
Mike C said:Hi Simon, how did you test it? You can't just overwrite item.php and config.xml because there's a lot of stuff that changed between versions 2.1 and 2.2. In other words, how did you move the notification code fragments from the old to the new without messing up the versions of those files?
Please Log in or Create an account to join the conversation.
- Omar Ramos
-
- Offline
- Junior Member
- Posts: 30
Omar Ramos said:Hey guys,
Yesterday afternoon I was rereading this thread and noticed that nobody had really answered the question about author notifications or notifications for reply to a post so I added in that functionality (I took K2Joom's latest 1.1 file and added the additional methods required).
In trying to test this I also across another issue where a user that is assigned to a few specific categories is then unable to comment in other categories (for permissions it's more likely that you want them to only create/edit items in those categories but you don't necessarily want to limit users to only adding comments in those few categories) so I also added the option in backend user group creation for a "Post to All Categories" permission and have included it in the zip file attached.
More on that particular issue can be found here:
The notifications for authors and commenters (and the admin notification) all seem to be working well on my end.
K2Joom said:Hi Mike, The changes to the xml is just to setup what is displayed in the k2 parameters. For item.php, there are many changes but for test purposes, we did a straight like for like swap of these two files, exactly as previously mentioned.
I just checked the files on the server and we are running to V2.1 version then posted a commented and it was mailed.
I then exchanged it for the v2.2, posted a comment and no notification.
I have updated the V2.2 file with the auto notification and have tested it this morning.
Attached is the zip with the 2 new files and a help file.
Let me know how you get on.
Mike C said:Hi Simon, how did you test it? You can't just overwrite item.php and config.xml because there's a lot of stuff that changed between versions 2.1 and 2.2. In other words, how did you move the notification code fragments from the old to the new without messing up the versions of those files?
Please Log in or Create an account to join the conversation.