However, it only has the entity that is going to be saved - is there any way to see which properties on a member entity have been changed - eg if the IsApproved has changed from false to true?
I managed to do it by using the MemberSavingNotification and using the member service to get the old member details to compare against:
public class MemberSavingNotificationHandler : INotificationHandler<MemberSavingNotification>
{
private readonly Lazy<IEmailService> _emailService;
private readonly IMemberService _memberService;
public MemberSavingNotificationHandler(Lazy<IEmailService> emailService, IMemberService memberService)
{
_emailService = emailService;
_memberService = memberService;
}
public void Handle(MemberSavingNotification notification)
{
foreach (var member in notification.SavedEntities)
{
if (member.IsApproved)
{
var oldMember = _memberService.GetById(member.Id);
if (oldMember != null && !oldMember.IsApproved)
{
// send an email if user goes from not being approved, to being approved
_emailService.Value.Send(
member.Email,
"Email Subject - Account Approved",
"Email Body");
}
}
}
}
}
Member saved notification
I'm looking at creating a custom notification in umbraco 13 for when a member gets approved, so I was trying to follow this example: https://docs.umbraco.com/umbraco-cms/reference/notifications/memberservice-notifications
However, it only has the entity that is going to be saved - is there any way to see which properties on a member entity have been changed - eg if the IsApproved has changed from false to true?
I managed to do it by using the
MemberSavingNotification
and using the member service to get the old member details to compare against:is working on a reply...