Answers.Body: <p>Entries are currently the only element type which support that method fully.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-04T00:39:05.207Z
Answers.Text: 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?
Answers.UserDisplayName: Derek Pollard
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-04T15:47:55.643Z
Answers.Text: 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
Answers.UserDisplayName: Derek Pollard
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-03T23:28:56.117Z
Answers.LastActivityDate: 2021-02-03T23:28:56.117Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>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:</p>
  <pre class="lang-php prettyprint-override"><code>Event::on(User::class, User::EVENT_BEFORE_SAVE, static function (ModelEvent $event) {
      /** @var \craft\elements\User $user */
      $user = $event-&gt;sender;
  
      Craft::info('USER::EVENT_BEFORE_SAVE');
  
      Craft::info($user-&gt;getDirtyAttributes());
  });
  </code></pre>
  <p>When I update the users name or email from the admin panel, I get an empty array in my logs</p>
  <blockquote>
  <p>2021-02-03 17:20:18 [-][25250][-][info][application] USER::EVENT_BEFORE_SAVE</p>
  <p>2021-02-03 17:20:18 [-][25250][-][info][application] []</p>
  </blockquote>
  <p>From the API:</p>
  <blockquote>
  <p>Returns whether an attribute has changed since the element was first loaded.</p>
  </blockquote>
  <p>The way I have read that is whenever something changes on the model, it will be recorded in the above method output</p>
  <p>What am I doing wrong/missing here?</p>
  
Tags: <craft3><modules>
Title: getDirtyAttributes() not showing changes
ThreadText: # getDirtyAttributes() not showing changes
  
  (Asked by: username_0 on 2021-02-03)
  
  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:
  
  ```php
  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?
  
  **Tags:** craft3, modules
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-02-03. Score: 2 | Accepted answer
  
  Entries are currently the only element type which support that method fully.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_0**: 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  
  
  ---
  
  