Answers.Body: <p><strong>Update:</strong></p>
  <p>As of Craft 3.x, the deprecated <code>user</code> variable no longer works. Make sure to use the proper <code>currentUser</code> variable instead!</p>
  <hr />
  <p><strong>Original:</strong></p>
  <p><code>user</code> and <code>currentUser</code> are exactly the same. They contain the UserModel of the <strong>currently logged in user</strong>.</p>
  <p>Why are they exactly the same? Originally, <code>user</code> was the preset value for the current user. However, there were many cases of people <em>manually</em> setting a value for <code>user</code> (often in the context of a <code>for</code> loop through a group of users), and therefore overwriting the preset value. So P&amp;T introduced <code>currentUser</code> as an alias which was much less likely to be overwritten.</p>
  <p><code>account</code> will only exist on the <a href="http://buildwithcraft.com/docs/templating/user-registration-form" rel="nofollow noreferrer">User Registration Form</a>. Its value is automatically set when the form is submitted. <code>account</code> represents the values entered during the attempted registration (whether the registration was successful or not).</p>
  <p>For the sake of your Edit Profile pages, you'll want to use <code>currentUser</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-25T12:51:01.267Z
Answers.Text: We used to only set `user` to the currently logged-in user, but after receiving some feedback that it wasn’t descriptive enough we decided to also add `currentUser` in [Craft 1.2](http://buildwithcraft.com/updates#build2333). We’ve tried to update all of the documentation to reference `currentUser` instead of `user` but the User Profile Form was apparently overlooked. I just went in and updated it.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-09-25T04:55:44.327Z
Answers.LastActivityDate: 2020-10-22T22:30:44.470Z
Answers.LastEditDate: 2020-10-22T22:30:44.470Z
Answers.UserDisplayName: Lindsey D
Body: <p>I notice in the template examples that <code>user</code>, <code>account</code> and <code>currentUser</code> are all being used, but not seeing clear documentation on these. Can someone perhaps explain the difference?</p>
  
  <p>Example <a href="http://buildwithcraft.com/docs/templating/user-registration-form" rel="nofollow">User Registration Form</a> uses <code>{{ account.username }}</code></p>
  
  <p>Example <a href="http://buildwithcraft.com/docs/templating/user-profile-form" rel="nofollow">User Profile Form</a> uses <code>{{ user.username }}</code></p>
  
  <p>and there is a <a href="http://buildwithcraft.com/docs/templating/global-variables" rel="nofollow">Global Variable</a> called <code>{{ currentUser.username }}</code></p>
  
  <p>I assume that <code>user</code> is perhaps just an alias to <code>currentUser</code> (unless explicitly defined otherwise)? And that <code>account</code> is something that is used exclusively for <code>user/saveUser</code>?</p>
  
  <p>The reason I ask is that I'm creating edit profile pages, and want to make sure they are secure. Seems like just using <code>user</code> is enough, as that appears to always be populated correctly with the <code>currentUser</code> data; and if not logged-in it redirects to the log-in page.</p>
  
  <p>Thanks.</p>
  
Tags: <users><user-profile><current-user>
Title: What's the difference between 'user', 'currentUser', and 'account'?
ThreadText: # What's the difference between 'user', 'currentUser', and 'account'?
  
  (Asked by: username_0 on 2014-09-25)
  
  I notice in the template examples that `user`, `account` and `currentUser` are all being used, but not seeing clear documentation on these. Can someone perhaps explain the difference?
  
  Example [User Registration Form](http://buildwithcraft.com/docs/templating/user-registration-form) uses `{{ account.username }}`
  
  Example [User Profile Form](http://buildwithcraft.com/docs/templating/user-profile-form) uses `{{ user.username }}`
  
  and there is a [Global Variable](http://buildwithcraft.com/docs/templating/global-variables) called `{{ currentUser.username }}`
  
  I assume that `user` is perhaps just an alias to `currentUser` (unless explicitly defined otherwise)? And that `account` is something that is used exclusively for `user/saveUser`?
  
  The reason I ask is that I'm creating edit profile pages, and want to make sure they are secure. Seems like just using `user` is enough, as that appears to always be populated correctly with the `currentUser` data; and if not logged-in it redirects to the log-in page.
  
  Thanks.
  
  **Tags:** users, user-profile, current-user
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-09-25. Score: 9 | Accepted answer
  
  **Update:**
  
  As of Craft 3.x, the deprecated `user` variable no longer works. Make sure to use the proper `currentUser` variable instead!
  
  ---
  
  **Original:**
  
  `user` and `currentUser` are exactly the same. They contain the UserModel of the **currently logged in user**.
  
  Why are they exactly the same? Originally, `user` was the preset value for the current user. However, there were many cases of people *manually* setting a value for `user` (often in the context of a `for` loop through a group of users), and therefore overwriting the preset value. So P&T introduced `currentUser` as an alias which was much less likely to be overwritten.
  
  `account` will only exist on the [User Registration Form](http://buildwithcraft.com/docs/templating/user-registration-form). Its value is automatically set when the form is submitted. `account` represents the values entered during the attempted registration (whether the registration was successful or not).
  
  For the sake of your Edit Profile pages, you'll want to use `currentUser`.
  
  > **Comments:**
  > **username_2**: We used to only set `user` to the currently logged-in user, but after receiving some feedback that it wasn’t descriptive enough we decided to also add `currentUser` in [Craft 1.2](http://buildwithcraft.com/updates#build2333). We’ve tried to update all of the documentation to reference `currentUser` instead of `user` but the User Profile Form was apparently overlooked. I just went in and updated it.  
  
  ---
  
  