Copied to clipboard

Flag this post as spam?

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


  • Tom 120 posts 448 karma points
    Sep 07, 2016 @ 07:03
    Tom
    0

    Hook into the Save User event?

    Hi,

    How do I hook into the Save User event in the backoffice?

    I want to call an external webapi if the user has been disabled.

    Thanks!

  • David Peck 690 posts 1896 karma points c-trib
    Sep 07, 2016 @ 07:22
    David Peck
    100

    I suggest you use the ApplicationEventHandler.

    using Umbraco.Core.Models.Membership;
    using Umbraco.Core.Services;
    
    namespace MyApplication
    {
        public class UmbracoEventHandler : ApplicationEventHandler
        {
            protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
            {
                UserService.SavedUser += UserServiceSaved;
    
                base.ApplicationStarting(umbracoApplication, applicationContext);
            }
    
            private void UserServiceSaved(IUserService sender, SaveEventArgs<IUser> e)
            {
                throw new NotImplementedException();
            }
        }
    }
    
  • Tom 120 posts 448 karma points
    Sep 07, 2016 @ 08:07
    Tom
    0

    Thanks David!

    That looks perfect!

  • 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