Copied to clipboard

Flag this post as spam?

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


  • Bex 444 posts 555 karma points
    Oct 14, 2014 @ 14:21
    Bex
    0

    Member_AfterDelete not firing

    Hi

    I am using umbraco 6.2.1 and I need to do something when a user deletes a member in the backend.

    I have set up a handler

         public class Events : IApplicationEventHandler
        {
            public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                Member.AfterDelete += Member_AfterDelete;
    
            }
    
            void Member_AfterDelete(Member sender, umbraco.cms.businesslogic.DeleteEventArgs e)
            {
    
               int id= sender.Id;
    
    
            }
    }
    

    It seems to initialise my method but my breakpoint never breaks when I delete a member.

    Is there another way of doing this or am I missing something.

    Bex

  • Bex 444 posts 555 karma points
    Oct 14, 2014 @ 15:19
    Bex
    0

    worked it out! You need

     public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                MemberService.Deleted += MemberService_Deleted;
    
            }
    
            void MemberService_Deleted(IMemberService sender, Umbraco.Core.Events.DeleteEventArgs<Umbraco.Core.Models.IMember> e)
            {
               var member= e.DeletedEntities.First();
                int id = member.Id;
            }
    
  • Charles Afford 1163 posts 1709 karma points
    Oct 19, 2014 @ 15:51
    Charles Afford
    0

    Thanks for the post Bex that's usefull :).

    Charlie.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies