This project is read-only.

Comments Notification

Topics: General
Jan 31, 2012 at 12:33 AM

With Orchard 1.3.10 I am trying to have an e-mail sent when a comment is created.  I have done this:

install messaging module
install e-mail messaging module
enable "Comments Rules"
Create a rule
Add an event

When I follow the above sequence, I am told "There are no currently available events."  If I go enable "Contents Rules", then I am given a selection of events to work with, but none of them pertain to the creation of a comment.

I see a request for this capability here.  Bertrand's answer is that there is a module for this (presumably "messaging" and "email messagin") and a rule for this (presumably "comments rules").  But as stated, it isn't working.  What am I doing wrong?  Is this a defect in 1.3.10?

Jan 31, 2012 at 2:18 AM

The event you need is not specific to comments: it's the publication of content items, and you're going to configure it to only respond to publication of comments.

Feb 10, 2012 at 4:58 PM

FYI, I recently just creates a fork and submitted a pull request to add tokens specific to Comments:

These tokens will allow you to access the author and body of the comment, as well as the content item that the comment was created on. Hopefully this fork will get pulled into the Comments module at some point. If you want to use it now, just add the class in that changeset to the Orchard.Comments module in your site. The only issue (which hopefully the team can help clear up) is that you also need to remove the SecurityTransparent attribute from both the Orchard.Comments and Orchard.Tokens modules. I couldn't figure out why that was necessary.

Feb 10, 2012 at 5:11 PM

The issue is that you actually should have [SecurityTransparent] attribute in all modules / themes, to avoid errors when you try to access services in modules that have [SecurityTransparent]. I raised a workitem that CodeGeneration should include this attribute by default.

Feb 10, 2012 at 5:56 PM

Kevin, for the tokens, please file a bug too, pointing to the fork, so we can triage it.

Feb 10, 2012 at 5:58 PM

But both Orchard.Comments and Orchard.Tokens had that attribute and I had to remove it from both of them in order to make it work (I added a reference from Orchard.Comments to Orchard.Tokens in order to implement an ITokenProvider in Orchard.Comments). As soon as I did that the site wouldn't load due to the security exception. It only worked after removing it from both projects.

Feb 10, 2012 at 6:09 PM

Sebastien, no problem. I just filed the issue here:


Feb 10, 2012 at 6:17 PM

Maybe it was a third or a fourth one which had no attribute. If fixed it last week and found a few.

Feb 10, 2012 at 6:22 PM

Hmm. I created the fork on Wed (just two days ago) and implemented the Comments tokens on the 1.x tip. So there must be something still missing the attribute.

Feb 10, 2012 at 6:23 PM

Ok, let me try it then, you can even file a bug. Don't tell me you already did please

Feb 10, 2012 at 6:28 PM

Okay, I won't tell you that. But I will tell you to look up 3 comments before your last one on this thread.  :-P

Feb 26, 2012 at 1:52 AM
Edited Feb 26, 2012 at 1:58 AM

I just noticed that if I'm authenticated, and I leave a comment, my event rule for comment notification works: an e-mail is sent.  But if I am not authenticated, and I leave a comment, notification does not work: an e-mail is not sent.

Why is that?  Can this be fixed through configuration, or is this a bug?  I hope this is not because rules are tied to users!!!