Blog Ownership / Send email rule

Topics: Administration, Customizing Orchard
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 Email]   
from Orchard_Users_UserPartRecord a, Common_CommonPartRecord b, Orchard_Comments_CommentPartRecord c, Title_TitlePartRecord d 
where (c.ID = 81 AND c.CommentedOn = 78AND (
d.ContentItemRecord_id = c.CommentedOn AND
c.CommentedOnContainer = AND 
b.OwnerID = )

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.



Aug 16, 2012 at 11:15 PM

You're trying to send an e-mail to the owner of the comment. You need to send an e-mail to the comment's container's container's owner: the comment is in a post that is in a blog, whose owner you are interested in.

Aug 17, 2012 at 8:38 PM

Can it be done? My head has just exploded... :-)

Aug 20, 2012 at 7:00 AM

Sure: container is on the common part.

Aug 21, 2012 at 9:26 PM


Thanks for the response.

Ok, I can see {Content.Container} as one of the things to use in the list, but how do I go about stringing these things together to end up returning the text of the comment's container's container's owner?

This is the bit which foxes me.

Can you explain/show the answer or point me to the documentation please? I must be looking in the wrong place, for the wrong thing, or just plain missed it.




Aug 22, 2012 at 6:21 AM

Tokens are made to be chained. {Content.Container.Container.Owner.Email} should pretty much do the trick.

Aug 24, 2012 at 4:30 PM


I'm obviously wearing my stupid hat.

I just tried your {Content.Container.Container.Owner.Email} suggestion and it returns nothing.

I even tried breaking it down into its parts and each part returned nothing.

Other than giving myself a slap, what else can you suggest? :-)




Aug 26, 2012 at 8:25 AM

Attach a debugger and set a breakpoint in one of those tokens.