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;



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?

1 Answer 1


Entries are currently the only element type which support that method fully.

  • That would explain what I'm seeing. What would you suggest I use as a stop-gap? Also, is this something you'd be interested in letting me submit a PR to implement? Commented Feb 4, 2021 at 0:39
  • Also, did I overlook where this was specified in the documentation? want to make sure I'm looking at the correct places so I don't end up in this situation again Commented Feb 4, 2021 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.