Answers.Body: <p>Your answer with a <code>for</code> loop works but if you know there's only one image associated with that field, you can simplify your code using <code>.first()</code>:</p>
  
  <pre><code>    &lt;img src="{{ entry.author.authorImage|length ? entry.author.authorImage.first().getUrl() : '/images/userprofiledefault.jpg' }}" alt="{{ entry.author.getFullName }}"&gt;
  </code></pre>
  
  <p>Think of assets (and relationships in general) as a <a href="http://buildwithcraft.com/docs/assets-fields#templating" rel="nofollow">container</a> that can hold more than one asset (or relationship). That's why you need to tell Craft <em>which</em> one you want—even if there's only one. Your <code>for</code> loop works because it's looping through that object (technically an ElementCriteriaModel object).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-07T18:00:50.240Z
Answers.Text: Ah perfect. Thanks for that. Will swap it out for that.
Answers.UserDisplayName: Gary
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-07T19:22:11.437Z
Answers.Text: @Gary when using first you should check if it does return an asset model before accessing one of its properties!
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-07T23:04:46.490Z
Answers.Text: Good thought carlcs, updated my answer to include a fallback image.
Answers.UserDisplayName: RitterKnight
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-07T17:54:55.863Z
Answers.LastActivityDate: 2015-11-07T23:04:03.933Z
Answers.LastEditDate: 2015-11-07T23:04:03.933Z
Answers.UserDisplayName: RitterKnight
Answers.Body: <p>Ah it would of been handy if I had of entered the assets loop!</p>
  
  <pre><code>  {% for asset in entry.author.authorImage %}
      &lt;img src="{{ asset.getUrl() }}" alt="{{ entry.author.getFullName }}"&gt;
    {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-11-06T14:18:35.463Z
Answers.LastActivityDate: 2015-11-06T14:18:35.463Z
Answers.UserDisplayName: Gary
Body: <p>I have a custom field for a user which is an asset, it has the users larger profile photo.</p>
  
  <p>In an entry template I can get their profile photo using:</p>
  
  <pre><code>{{ entry.author.getPhotoUrl }}
  </code></pre>
  
  <p>But I want to get the custom field.</p>
  
  <p>Something like:</p>
  
  <pre><code>{{ entry.author.authorImage }}
  </code></pre>
  
  <p>I am sure I am missing something very simple?</p>
  
Tags: <users>
Title: How can I get an entries author custom field?
ThreadText: # How can I get an entries author custom field?
  
  (Asked by: username_0 on 2015-11-06)
  
  I have a custom field for a user which is an asset, it has the users larger profile photo.
  
  In an entry template I can get their profile photo using:
  
  ```
  {{ entry.author.getPhotoUrl }}
  
  ```
  
  But I want to get the custom field.
  
  Something like:
  
  ```
  {{ entry.author.authorImage }}
  
  ```
  
  I am sure I am missing something very simple?
  
  **Tags:** users
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2015-11-07. Score: 1 | Accepted answer
  
  Your answer with a `for` loop works but if you know there's only one image associated with that field, you can simplify your code using `.first()`:
  
  ```
      <img src="{{ entry.author.authorImage|length ? entry.author.authorImage.first().getUrl() : '/images/userprofiledefault.jpg' }}" alt="{{ entry.author.getFullName }}">
  
  ```
  
  Think of assets (and relationships in general) as a [container](http://buildwithcraft.com/docs/assets-fields#templating) that can hold more than one asset (or relationship). That's why you need to tell Craft *which* one you want—even if there's only one. Your `for` loop works because it's looping through that object (technically an ElementCriteriaModel object).
  
  > **Comments:**
  > **username_0**: Ah perfect. Thanks for that. Will swap it out for that.  
  > **username_2**: @username_0 when using first you should check if it does return an asset model before accessing one of its properties!  
  > **username_1**: Good thought username_2, updated my answer to include a fallback image.  
  
  ---
  
  ### Answer by username_0 on 2015-11-06. Score: 1
  
  Ah it would of been handy if I had of entered the assets loop!
  
  ```
    {% for asset in entry.author.authorImage %}
      <img src="{{ asset.getUrl() }}" alt="{{ entry.author.getFullName }}">
    {% endfor %}
  
  ```
  
  
  ---
  
  