Copied to clipboard

Flag this post as spam?

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


  • John 1 post 71 karma points
    Nov 26, 2015 @ 21:55
    John
    0

    Umbraco User

    Hi, we have many sites and save basic user information such as name and address in a central database.

    Is it possible to intersept the umbraco user data types crud operations so we can post changes back to our main db?

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Nov 26, 2015 @ 23:20
    Nicholas Westby
    0

    Are you talking about members of the website or users of Umbraco? Assuming users of Umbraco, you can use the UserService to hook into events and respond to them appropriately (e.g., by storing info to your main DB):

    Umbraco.Core.Services.UserService.SavedUser += UserService_SavedUser;
    

    If you are actually talking about members of the website, you can do that too:

    Umbraco.Core.Services.MemberService.Saved += MemberService_Saved;
    

    You typically do event subscription like that shown above as described here: https://our.umbraco.org/Documentation/Getting-Started/Code/Subscribing-To-Events/

    public class LogWhenPublished : ApplicationEventHandler
    {
        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            Umbraco.Core.Services.ContentService.Published += ContentService_Published;
        }
    }
    

    That is the example they show at the above link. You essentially create a class that inherits from ApplicationEventHandler, then override the ApplicationStarted method to add your event subscription code (in your cases, you'd listen to either user or member events).

Please Sign in or register to post replies

Write your reply to:

Draft