For my project, I need to hook into the Publish event when publishing a document node:
The job nodes in the above screenshot are entered by members. They are not published immidiately, this is only allowed by the site administrator. When the site administrator publishes a job, the site member that entered the job node should be sent an email that his job has been published.
So for this scenario I guess I should hook into Umbraco Publish event.
I have never done this I am looking for some assistance (documentation, sample code, ...)
Thanks, this looks like just what I need. Just one question, do I have to add the event handler (for sending email when a job node gets published) as a .cs file in my web application project where my other user controls (.ascx) reside?
how to hook into Umbraco Publish Event
Hi,
For my project, I need to hook into the Publish event when publishing a document node:
The job nodes in the above screenshot are entered by members. They are not published immidiately, this is only allowed by the site administrator. When the site administrator publishes a job, the site member that entered the job node should be sent an email that his job has been published.
So for this scenario I guess I should hook into Umbraco Publish event.
I have never done this I am looking for some assistance (documentation, sample code, ...)
Thanks for your help,
Anthony
Hi Anthony
You can see a full overview of the different events in Umbraco here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/overview-of-all-events
And there are some samples on how to hook into the events here: http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples - I think the auto expire news sample might be just what you're looking for? :)
Hope this helps.
/Jan
Hi Jan,
Thanks, this looks like just what I need. Just one question, do I have to add the event handler (for sending email when a job node gets published) as a .cs file in my web application project where my other user controls (.ascx) reside?
Thanks for your help,
Anthony
Hi Jan,
Found it, created a new class in my web application project that inherits from umbraco.BusinessLogic.ApplicationBase
I use the Document.AfterPublish() event
Everytime a job node gets published an automatic email is sent to the member who added the job.
Thanks for your help,
Anthony
For those looking for Version > 8 information you might want to visit
Subscribing to Events
is working on a reply...