This project is read-only.

Script Action: New Blog Entry

Topics: Customizing Orchard
Feb 14, 2013 at 8:39 PM
Edited Feb 14, 2013 at 8:49 PM
Hey everyone. I have been delving a little deeper into the rules for Orchard, and I was thinking this would be cool. What I would like to do is when a specific content item is published, a blog entry is automatic created. I realize some base things would have to be configured, such as the layout. Is anyone currently doing something like this, or have any ideas of how to do this?

Thanks in advance folks.
Feb 15, 2013 at 12:07 AM
Sure, just use the content manager to create the post from an action.
Feb 21, 2013 at 4:44 PM
Edited Feb 21, 2013 at 4:46 PM
Thanks for your response. I'm hoping you can offer some clarification. Are you talking about the Actions dropdown on the /Admin/Contents/List page? If so, I only have Publish Now, Unpublish, or Delete as options. Also, that is not automated.

I was wanting it to be like a Rule within Orchard; like when a specific content item is created, it publishes a blog post.
Feb 21, 2013 at 8:17 PM
I think Bertrand is talking about implementing a custom rules action by implementing IActionProvider.
From that custom action you can easily create a new Blog Post using IContentManager.
Feb 21, 2013 at 8:43 PM
Thanks for your help. I am not familiar with IActionProvider, is this a module? Is there a write-up on this or a guide of some sort? Thanks! :)
Feb 21, 2013 at 9:25 PM
I don't know of any write up on this, but it's actually quite simple.
In any case, the interface is defined in Orchard.Rules, and implementations are invoked by the Rules engine.
All you have to do is implement this interface (I would add a reference to Orchard.Rules instead of redefining the interface).
Have a look at existing implementations (if you have ReSharper installed, just right click on the interface and click "Go to Implementation").

I am writing a small tutorial that demonstrates how to create a custom action that sends out template messages. Should be ready next week.
Feb 25, 2013 at 3:46 PM
I'll give that a try, and thanks for your help.
Apr 4, 2013 at 3:48 PM
Did you get a chance to make that tutorial? I looked on the documentation page and didn't see anything.
Apr 4, 2013 at 5:31 PM
Edited Apr 4, 2013 at 5:31 PM
Yes, it's a 3-part tutorial, 2 of which have been written. The final part, the one you're interested in, will be written somewhere next week (I intended to have it ready 2 weeks ago, but that didn't work out well)

Apr 4, 2013 at 5:34 PM
Great! Still looks like useful stuff on those two. I really appreciate your level of involvement in the community and the support you provide. So thanks again.
Apr 4, 2013 at 5:55 PM
No problem, it's gladly done.