Intercept the action of a user being updated and get the 'before update' and 'after update' value of

Using a custom global event handler, I am trying to intercept the action of a user being updated specifically the enabled("UserEnabled") value of a user being updated when they are edited in the CMS. I need to compare the before and after update value of the field and perform custom logic if the user was not enabled and is then changed to enabled.

I have been scouring through all the documentation and devnet posts that are somewhat related to this issue but cannot find the resolution I require. Can anyone help? Code attached:

Recent Answers

Hook on the before as you have, the user.object will have the user info that will be saved momentarily. You can then do a lookup using the UserInfoProvider to get the current user state and compare. If you need the custom logic to occur after the update, then you will be to save in the session the user Id and past enabled state during the before and then you can pull that up in the after hook.

Could you perhaps give me an example using my code snippet so I can understand your advice a little better? I find that when my method UserGroup_UpdateAfterEventHandler is triggered, the user.Object "Enabled" value is not the 'before' value, but is instead the updated value.

Hi, I'm doing something similar. I'm running a function before the user object gets updated.
I'm comparing the UserInfo GetOriginalValue() and GetValue() values and they are identical. They are both showing the "before" values.
I need to get the value that was entered on the form on the webpage so that I can do a comparison.
My code is similar to the codes shared by Peter Mogilnitski, just that the column I'm checking is the user's "LastName".
How do I get the new value that was entered by the user?