Answers.Body: <p>If i understand your question correct, you like to output the user data. I don't think that you need the getContent() function. But it's important, that you use the first() function. Here is your code:</p>
  
  <pre><code>{% set userProfile = craft.users.id(userId).first() %}
  {{ userProfile.yourFieldname }} 
  </code></pre>
  
  <p>Hope it works.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-10T18:50:38.993Z
Answers.Text: Cheers overlooked that!
Answers.UserDisplayName: Lettie
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-09T16:27:09.037Z
Answers.LastActivityDate: 2016-03-09T16:27:09.037Z
Answers.UserDisplayName: Tom Bauer
Body: <p>I'm trying to pull out user data in a template for specified user profiles whilst the current user is logged in. To do this I check on the userId being referenced and use:</p>
  
  <pre><code>{% if userId != currentUser.id %}
      {% set userProfile = craft.users.id(userId).getContent() %}
  {% endif %}
  </code></pre>
  
  <p>This returns a user object for that user. However when I try to reference any of the fields custom or otherwise for the userProfile it returns blank apart from on userProfile.id which returns the id of the required user.</p>
  
  <p>So what am I missing? I was under the impression that getContent() would pull out all custom fields and these could simply be accessed by using the dot syntax? Or does this only work on currentUser?</p>
  
  <p>Cheers</p>
  
Tags: <templating><users><custom-field>
Title: How to pull out all user data in a template?
ThreadText: # How to pull out all user data in a template?
  
  (Asked by: username_0 on 2016-03-09)
  
  I'm trying to pull out user data in a template for specified user profiles whilst the current user is logged in. To do this I check on the userId being referenced and use:
  
  ```
  {% if userId != currentUser.id %}
      {% set userProfile = craft.users.id(userId).getContent() %}
  {% endif %}
  
  ```
  
  This returns a user object for that user. However when I try to reference any of the fields custom or otherwise for the userProfile it returns blank apart from on userProfile.id which returns the id of the required user.
  
  So what am I missing? I was under the impression that getContent() would pull out all custom fields and these could simply be accessed by using the dot syntax? Or does this only work on currentUser?
  
  Cheers
  
  **Tags:** templating, users, custom-field
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-03-09. Score: 4 | Accepted answer
  
  If i understand your question correct, you like to output the user data. I don't think that you need the getContent() function. But it's important, that you use the first() function. Here is your code:
  
  ```
  {% set userProfile = craft.users.id(userId).first() %}
  {{ userProfile.yourFieldname }} 
  
  ```
  
  Hope it works.
  
  > **Comments:**
  > **username_0**: Cheers overlooked that!  
  
  ---
  
  