1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Hook into Saved event when a post is created / edited

Hook into Saved event when a post is created / edited

7 posts, 0 answered
  1. License Developer
    License Developer avatar
    31 posts
    Registered:
    18 Jun 2008
    26 Sep 2008
    Link to this post
    Hi,

    I need to do some things when a post is created or edited and am looking for where to do this.

    Specifically if someone posts or edits the client wants someone on their side to get an email. The email should have the contents of the post, the user who posted it, and a link to the post.

    It would also be good if we could add in the same "Subscribe me for this thread" functionality that exists here, in this forum.

    I looked at EditThread.ascx and it doesn't have a code behind? When someone clicks the "saveButton" where can I hook into that event?

    It would also be great if I could add new properties to the Forums Control so that I could put the smtp server, from address, etc as editable properties through the CMS.

    Thanks
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    26 Sep 2008
    Link to this post
    Hello License Developer,

    please take a look at the following forum thread for more information about application wide events in Sitefinity to which you can hook up your custom code:

    http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bgcmtm.aspx

    I hope you'll find this information helpful. Let us know if there is anything else we can do for you.

    All the best,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. License Developer
    License Developer avatar
    31 posts
    Registered:
    18 Jun 2008
    30 Sep 2008
    Link to this post
    The examples that I saw looked like they were geared towards hooking into events of modules based off of generic content.

    Is there a more explicit example that I could find that could help me hook into when a user posts/ edits/ replys to a post in forums specifically?

    Is this request something that would be better for me to submit as a ticket? From what I saw in the links provided there should be a way to do this, I just couldn't find any examples that got me on track.

    Thanks,

    Brett
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    02 Oct 2008
    Link to this post
    Hi Bret,

    I regret to inform you that you can subscribe to an events from modules which are Generic Content based. The  Forums module is not Generic Content based, which means that the ContentManager will be executed, but will not contain the arguments (which item is created, is it a new post or delete post event).
    One thing is for sure - we are going to remake the forums module for our major 4.0 release. It will be Generic Content Based and you would be able to use these events for it.

    We have the "Subscribe me for this thread" functionality logged as a feature request but we considered that it will be better if we implement it when the new Forums module is ready.

    We are sorry that could not help you much in this case.

    Greetings,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    09 Jan 2009
    Link to this post
    I am also looking for both of these capabilities (subscribe me and notification of post create/edit). Before embarking on a cumbersome solution using database triggers) I just want to verify that there is current no programmatic way to implement these features until Sitefinity 4.0. Is that correct?

    Thanks,
    Gary
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Jan 2009
    Link to this post
    Hello Gary,

    I have good news for you. We implemented events to which you can attach, when creating Forum, PostThreads, DeleteThreads and EditThreads.

    The available events are:

    - CreateForum
    - DeleteForum
    - CreatePost
    - DeletePost
    - UpdatePost

    Here goes the sample code:

        void Application_Start(object sender, EventArgs e)  
        { 
              Telerik.Forums.ForumManager.Executing += new EventHandler<Telerik.ExecutingEventArgs>(ForumManager_Executing); 
        } 
     
        void ForumManager_Executing(object sender, Telerik.ExecutingEventArgs e) 
        { 
            if (e.CommandName == "CreatePost"
            { 
                Telerik.Forums.IPost item = e.CommandArguments as Telerik.Forums.IPost; 
                // item.Content ... 
                // item.Title 
                // item.SomeThingElse 
            } 
        } 

    You can use this in version 3.2SP2 Hotfix and newer.

    In 4.0, all modules' APIs will be enchanted.

    Best wishes,
    Georgi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Gary
    Gary avatar
    91 posts
    Registered:
    19 Jul 2007
    09 Jan 2009
    Link to this post
    Georgi,

    That is great information. Thank you very much.

    Regards,
    Gary
Register for webinar
7 posts, 0 answered