Are there any known issues with wiring up Member event handlers? I had a look on the issue tracker and didn't notice anything relevant. The issue I have is that I need to hook into the MemberService.Deleted event but it doesn't appear to be firing.
I have it wired up as follows:
public class MyApplication : ApplicationEventHandler
{
private IMyMemberService _myMemberService;
public MyApplication(IMyMemberService myMemberService)
{
this._myMemberService = myMemberService;
}
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
MemberService.Deleted += MemberService_Deleted;
}
private void MemberService_Deleted(IMemberService sender, Umbraco.Core.Events.DeleteEventArgs<Umbraco.Core.Models.IMember> e)
{
var member = this._myMemberService.GetByUserId((int)e.DeletedEntities.FirstOrDefault().ProviderUserKey);
this._myMemberService.Delete(member);
}
}
Turns out that it seems that your cannot inject a dependency in this class.
I did it the way Asembli did but with an injected component in the constructor and the MemberServiceDeleted method wasn't hit when deleting a member. Then I removed the injection and it worked like a charm.
MemberService.Deleted Not Fired
Are there any known issues with wiring up Member event handlers? I had a look on the issue tracker and didn't notice anything relevant. The issue I have is that I need to hook into the MemberService.Deleted event but it doesn't appear to be firing.
I have it wired up as follows:
Any ideas appreciated.
Thanks
Hi Simon
It looks like not related to your issue, but there are no docs about MemberService events in documentation section - https://our.umbraco.org/documentation/reference/events/
Hi,
hm late reply, but anyway, I was looking for the same fn and must say that this excerpt worked for me (7.15.3)
BTW if you work with Members section don't forget to include this patch: https://github.com/umbraco/Umbraco-CMS/issues/6283
Regards, /Asembli
Yoyoyoyo,
Turns out that it seems that your cannot inject a dependency in this class. I did it the way Asembli did but with an injected component in the constructor and the MemberServiceDeleted method wasn't hit when deleting a member. Then I removed the injection and it worked like a charm.
Peace,
Sam
is working on a reply...