I am hoping to track a couple of things about a user:
- was he suspended?
- was he restored (un-suspended)
- did his email change
I have created an event listener (observer) that registers '\core\event\user_updated' but am not getting any meaningful information.
Is there a way for me to be able to compare the state of the user before AND after the changes so that I can assess what changed and take the appropriate action if need be?
Help me, Obi-Wan Kenobi. You're my only hope.
This is the payload from the event I get:
core\event\user_updated Object(
[data:protected] => Array
(
[eventname] => \core\event\user_updated
[component] => core
[action] => updated
[target] => user
[objecttable] => user
[objectid] => 42
[crud] => u
[edulevel] => 0
[contextid] => 221
[contextlevel] => 30
[contextinstanceid] => 42
[userid] => 2
[courseid] => 0
[relateduserid] => 42
[anonymous] => 0
[other] =>
[timecreated] => 1588890523
)
[logextra:protected] =>
[context:protected] => context_user Object
(
[_id:protected] => 221
[_contextlevel:protected] => 30
[_instanceid:protected] => 42
[_path:protected] => /1/221
[_depth:protected] => 2
[_locked:protected] => 0
)
[triggered:core\event\base:private] => 1
[dispatched:core\event\base:private] =>
[restored:core\event\base:private] =>
[recordsnapshots:core\event\base:private] => Array
(
)
)