Aug 15, 2012 at 5:12 PM
Edited Aug 15, 2012 at 8:46 PM
I'm new to Orchard. I'm using v1.5.1.
My site has three blogs within it each owned by a different user; although I believe I created the blogs as webmaster (admin) and then changed the ownership later on the blog properties page.
I'm trying to create a rule so that when a comment is submitted against a particular blog post an email is sent to the owner (author) of the blog. I'm trying to do this using a rule and the Send e-mail action.
So on the Rules page in the Dashboard I've created a rule with an Event of when content with type comment is created and an Action of send an email.
On the Edit Action - Send e-mail page, when I choose the Owner "Send to" option no email is sent. If I specify an the address in "Other" instead it works ok. So I know it is not the email settings or the address, it seems Orchard isn't getting
the blog owner's email address correctly.
So my question is, how do I find the email address of the owner of the blog the comment is being written for, and how can I make this available to the Send-email rule?
Any help or pointers from the more experienced Orchard world would be appreciated.
Having poked about in the database I know I can get the information I'm after using a query like this (probably not the best way, but I am only tinkering/exploring)
select c.Author as [Comment Author], c.CommentText as [The
Comment], d.Title as [Blog Title], a.Username as [Blog Author], a.Email as [Author
from Orchard_Users_UserPartRecord a, Common_CommonPartRecord b, Orchard_Comments_CommentPartRecord c, Title_TitlePartRecord d
where (c.ID = 81 AND c.CommentedOn
= 78) AND (
d.ContentItemRecord_id = c.CommentedOn AND
c.CommentedOnContainer = b.id AND
b.OwnerID = a.id )
The values for c.ID and c.CommentedOn are available in the Edit Action, so now I just need to figure out how to make use of the query and the data it returns to construct a useful and informative email directed to the author of the blog to alert them
to the comment being made.
Suggestions welcomed, laughter listened to.