Add logic when user post a blog post in back-end - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Add logic when user post a blog post in back-end

  • Add logic when user post a blog post in back-end
  • So i want to catch an event occurs when a back-end user posts a blog post.

     

    Is there any possible way to do that?

     

     

  • Hello,

    You can use the IDataEvent from the EventHub and check for the item type - whether it is a blog item - this will be called on every operation.

    Please consult following documentation for additional information:
    http://docs.sitefinity.com/for-developers-idataevent

    eg.
    private void Content_Action(IDataEvent @event)
        var action = @event.Action;
        var contentType = @event.ItemType;
        if (contentType == TypeResolutionService.ResolveType("Telerik.Sitefinity.Blogs.Model.BlogPost"))
        
            // do something
            var itemId = @event.ItemId;
            var providerName = @event.ProviderName;
            var manager = ManagerBase.GetMappedManager(contentType, providerName);
            var item = manager.GetItemOrDefault(contentType, itemId);
        

    Regards,
    Dimitri Cools
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  • I have used the same for accessing & for enhance some of the custom functionality of blogpost, for that I have define some custom fields inside the blogposts so how can I access the data of this custom fields.
  • Hello Anand,

    Once you get the blogpost, you can manage the custom field you need, as described in the sample here:
    http://docs.sitefinity.com/for-developers-set-the-value-of-a-custom-field

    Regards,
    Svetoslav Manchev
    Telerik by Progress
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items