Copied to clipboard

Flag this post as spam?

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


  • Brendan Rice 538 posts 1102 karma points
    Sep 22, 2010 @ 17:23
    Brendan Rice
    0

    Umbraco Member Event Syncing with MailChimp

    I need to sync umbraco members with a MailChimp account.  The bit I am struggling with is the following events and knowing when to create/update/delete an email in MailChimp.

    If I am in the Ubraco admin section and I create a user the event AfterNew is fired followed by BeforeSave then AfterSave.  I was going to put a flag in to the AfterNew to say that the member is a new member and add them to MailChimp ain AfterSave.

    When the Member is being edited in Umbraco I need to know what the old/new email addresses are for syncing purposes.  What is the best practice for going about this?  BeforeSave sender already has the updated email and when I do a Member.GetMemberFromLoginName the member email is already updated, any help would be great.

     

       public class UmbracoMembershipIntegration :  ApplicationBase
        {
            public UmbracoMembershipIntegration()
            {
                Member.BeforeSave += new Member.SaveEventHandler(Member_BeforeSave);
                Member.AfterSave += new Member.SaveEventHandler(Member_AfterSave);
                Member.AfterDelete += new Member.DeleteEventHandler(Member_AfterDelete);
                Member.BeforeDelete += new Member.DeleteEventHandler(Member_BeforeDelete);
            }

            void Member_BeforeDelete(Member sender, DeleteEventArgs e)
            {
                Member member = sender;
            }

            void Member_BeforeSave(Member sender, SaveEventArgs e)
            {
                Member member = sender;
            }

            void Member_AfterDelete(Member sender, DeleteEventArgs e)
            {
                Member member = sender;
            }

            public void Member_AfterSave(Member sender, umbraco.cms.businesslogic.SaveEventArgs e)
            {
                Member member = sender;
            }
        }

     

Please Sign in or register to post replies

Write your reply to:

Draft