Custom Events

Topics: Customizing Orchard, General, Writing modules
May 22, 2012 at 3:28 PM
Edited May 23, 2012 at 8:21 AM

Hey,

 

tl;dr: Custom events in rules section.

 

I currently have a little time at work to improve some of our current modules. Score. So we have a custom registration module, that uses the IUserEventHandler and has a bunch of other events on top of that. So for example to reset password etc. At the moment we have a messaging module that sends out emails when you are registered, we have a slightly complex registration email system so we don't just use on creation of a user send an email.

Now this all works fine but what I would really like is some custom events in the rules section. So when a user registers and say the FreeUserRegistered event is fired, right now the messaging module goes: Oh, yay, and sends the email. Obviously this not totally ideal since it means having to write custom views each time we deploy the module. Not a big thing, but means we have to do it and the client cant blunder around writing his own silly emails. And that is what we all desire. Let them pay us and do the work themselves.

So what I would really like is to have a FreeUserRegistered event in the Rules section, and then use the standard email action. I have had a quick look and I assume it is possible, though I am not quite sure how to go about it. I see you need to implement IEventProvider and Describe.

Was just wondering if anyone had done something along these lines. I am loving the whole Event Bus in my code, but would be great to get it going in the Rules event bit. Would be sexy. I will blunder around for a bit, thought I would post here before I begin to get any feedback since I am not particularly experienced in Orchard development or web development in general to be honest.

Thanks for your time,

Hazza