Copied to clipboard

Flag this post as spam?

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


  • Joao 2 posts 22 karma points
    Jun 14, 2014 @ 01:42
    Joao
    0

    Member.BeforeSave not firing

    Hi,

    I've looked for an answear for this in the forum and on the web, but I can only find for previous versions of Umbraco. I'm sorry if this question is repeated.

    I'm using an umbraco 7.1.4 fresh install and I'm not managing to catch the before save event. I want to catch if the member is being activated to send him a welcome e-mail, so I was thinking of catching the beforeSave and AfterSave events, to see if the property isAproved is changed.

    My code is this:

    (... usings ...)

    namespace MyControls.EventHandler
    {   
    public class MemberHandler : IApplicationEventHandler
        {
            public int member_isApprovedBeforeValue = 0;
            public MemberHandler()
            {}

            /// <summary>
            /// Triggers before a member is save to save the IsAoproved property before
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param> 
            void Member_BeforeSave(Member sender, SaveEventArgs e)
            {
                (STUFF)
            }

            /// <summary>
            /// Triggers after a member is saved to get the IsAoproved property. If changed to yes, sends mail to user
    welcoming him
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param> 
            void Member_AfterSave(Member sender, SaveEventArgs e)
            {
                (STUFF)
            }

            public void OnApplicationStarted(UmbracoApplicationBase httpApplicationBase, ApplicationContext applicationContext)
            {           
    Member.BeforeSave += Member_BeforeSave;
            }

            // other functions in Interface 
            public void OnApplicationStarting(UmbracoApplicationBase httpApplicationBase, ApplicationContext applicationContext)
            {}

    public void OnApplicationInitialized(UmbracoApplicationBase httpApplicationBase, ApplicationContext applicationContext)
            {}

        }
    }

     

    in debug mode I can see the event being added in OnApplicationStarted method. However, i don't hit the Member_BeforeSave method when saving the member.

    What am I doing wrong?

    Thank you,

    Joao

  • Joao 2 posts 22 karma points
    Jun 18, 2014 @ 20:10
    Joao
    0

    No one has achieved firing this event on umbraco 7 yet?

    I really need your help guys.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft