Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Feb 05, 2012 @ 10:40
    Anthony Candaele
    1

    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

  • Jan Skovgaard 11257 posts 23497 karma points MVP 7x admin c-trib
    Feb 05, 2012 @ 10:53
    Jan Skovgaard
    2

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 05, 2012 @ 11:21
    Anthony Candaele
    0

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Feb 05, 2012 @ 11:58
    Anthony Candaele
    3

    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

  • Ken Schnell 34 posts 144 karma points
    Aug 05, 2020 @ 18:49
    Ken Schnell
    0

    For those looking for Version > 8 information you might want to visit

    Subscribing to Events

Please Sign in or register to post replies

Write your reply to:

Draft