I've got an event listener in a custom plugin where I want to check to see if the users email updated, but it doesnt show that attribute as dirty, even though I know it should be:
Event::on(User::class, User::EVENT_BEFORE_SAVE, static function (ModelEvent $event) {
/** @var \craft\elements\User $user */
$user = $event->sender;
Craft::info('USER::EVENT_BEFORE_SAVE');
Craft::info($user->getDirtyAttributes());
});
When I update the users name or email from the admin panel, I get an empty array in my logs
2021-02-03 17:20:18 [-][25250][-][info][application] USER::EVENT_BEFORE_SAVE
2021-02-03 17:20:18 [-][25250][-][info][application] []
From the API:
Returns whether an attribute has changed since the element was first loaded.
The way I have read that is whenever something changes on the model, it will be recorded in the above method output
What am I doing wrong/missing here?