Member Event Handler run only if the member update is made by member
Hello,
I use the following event handler to send a notification e-mail to newly registered members. The client needs to be informed when members update their profile. How can i separate the member update events made by members or by site administrators and send email to site administrator if member made a profile update?
private void MemberService_Saving(Umbraco.Core.Services.IMemberService sender, Umbraco.Core.Events.SaveEventArgs<Umbraco.Core.Models.IMember> e)
{
//custom code
foreach (IMember member in e.SavedEntities)
{
if (member.HasProperty("memberApproved") && member.Properties["memberApproved"].IsDirty() && member.GetValue("memberApproved").ToString() == "1")
{
MailMessage message = new MailMessage();
message.To.Add(member.Email);
message.Subject = "Subscription approved";
message.IsBodyHtml = true;
message.From = new System.Net.Mail.MailAddress("[email protected]", "Site Name");
message.Body = "Your member account is approved.";
SmtpClient smtp = new SmtpClient();
smtp.Send(message);
}
}
}
Member Event Handler run only if the member update is made by member
Hello,
I use the following event handler to send a notification e-mail to newly registered members. The client needs to be informed when members update their profile. How can i separate the member update events made by members or by site administrators and send email to site administrator if member made a profile update?
is working on a reply...