I have an event handler that sets a property on a member when saving, however, I'd quite like to check if a property is dirty, to avoid hitting the code on every save.
To do this, I have used, which correctly returns true / false dependant on if the property has been changed.
However, when this is added into my event handler, the SetValue and Save events no longer do anything. The weird thing is, all the code is reached, so it should be working!
if (saved.IsApproved && dirtyApproval)
{
saved.SetValue("validateGUID", "RATPig");
sender.Save(saved, false);
}
So I'm seeing some rather strange behaviour here...
.isApproved, seems to be unreliable, it often returns true, even when the is approved box is unticked on the profile.
I started using .HasProperty("umbracoMemberApproved"), which has it's own quirks!
// Tests, Save Member
// Approval Checkbox state, hasProperty return value.
// false = false
// true = true
// true, 2nd save = false
// true, 3rd save = false
// false, 1st save after state change = false
// true, 1st save after state change = true
// true, 2nd save = false
When allows me to detect when the value of umbracoMemberApproved changes from false to true, but doesn't fire on every other save. But will re-fire if the users becomes unApproved, and then approved again.
Member Event Handler & IRememberBeingDirty
I have an event handler that sets a property on a member when saving, however, I'd quite like to check if a property is dirty, to avoid hitting the code on every save.
To do this, I have used, which correctly returns true / false dependant on if the property has been changed.
However, when this is added into my event handler, the
SetValue
andSave
events no longer do anything. The weird thing is, all the code is reached, so it should be working!I am hooking into:
So I'm seeing some rather strange behaviour here...
.isApproved, seems to be unreliable, it often returns true, even when the is approved box is unticked on the profile.
I started using
.HasProperty("umbracoMemberApproved")
, which has it's own quirks!This means I can do...
When allows me to detect when the value of
umbracoMemberApproved
changes from false to true, but doesn't fire on every other save. But will re-fire if the users becomes unApproved, and then approved again.This was resolved in the subsequent Umbraco release.
is working on a reply...