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) }
// 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.
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
No one has achieved firing this event on umbraco 7 yet?
I really need your help guys.
Thanks
is working on a reply...