<p>If you're just looking to get the author of an entry, it's a simple as:</p>

<pre><code>{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {{ entry.author.firstName }} {{ entry.author.lastName }}

{% endfor %}
</code></pre>

<p>If you're looking to get every user associated with every <a href="https://craftcms.com/docs/users" rel="nofollow">Users field</a> for an entry, your <a href="https://craftcms.com/docs/relations#the-relatedTo-param" rel="nofollow">relatedTo</a> syntax will work:</p>

<pre><code>{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {% set allRelatedUsers =  craft.users.relatedTo(entry) %}

    {% for user in allRelatedUsers %}
        {{ user.firstName }} {{ user.lastName }}
    {% endfor %}

{% endfor %}
</code></pre>

<p>The reason that returned nothing in your original question is because the "author" field isn't a proper Users field type - it's more of a special case user field.</p>

CC BY-SA 3.0
2016-07-13T22:49:08.050Z
Thanks, Brad - the first example you gave does exactly what I wanted. The second example is identical to my original code and does not return anything, so would still like to understand why.
Roi Agneta
CC BY-SA 3.0
2016-07-13T22:50:05.263Z
The last sentence of the answer explains why. Let me know if it's not clear.
Brad Bell
CC BY-SA 3.0
2016-07-13T22:13:02.000Z
2016-07-13T22:13:02.000Z
Brad Bell
<p>I am trying to use the <code>relatedTo</code> parameter to get user details for a given entry with this code:</p>

<pre><code>{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {% set authorDetails =  craft.users.relatedTo(entry) %}

    {% for person in authorDetails %}
        {{ person.firstName }} {{ person.lastName }}
    {% endfor %}

{% endfor %}
</code></pre>

<p>The Title returns fine, but nothing else. First time I have used <code>relatedTo</code> and guess there is something I don't understand about usage. Any advice greatly appreciated!</p>

<p>Roi</p>

CC BY-SA 3.0
2016-07-13T20:38:00.823Z
Are you trying to just get the author of an entry? Or are you trying to get every user in any user field that might be attached to an entry?
Brad Bell
CC BY-SA 3.0
2016-07-13T22:02:01.383Z
Just trying to get the author's details, e.g. first name, etc.  I got it to work with the code below, but would still like to understand why my original code does not work.

 {% for entry in craft.entries.section('englishProficiencyTranslator').limit(1) %}
{{ entry.author }}

{% set au = entry.author %}
{% set person = craft.users.email(au) %}
{% for details in person %}
  {{ details.firstName }} 
{% endfor %}


{% endfor %}
Roi Agneta
CC BY-SA 3.0
2016-07-13T22:13:15.643Z
Added an answer.
Brad Bell
<relatedto>
Get User Object for a given Entry
# Get User Object for a given Entry

(Asked by: username_0 on 2016-07-13)

I am trying to use the relatedTo parameter to get user details for a given entry with this code:
{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {% set authorDetails =  craft.users.relatedTo(entry) %}

    {% for person in authorDetails %}
        {{ person.firstName }} {{ person.lastName }}
    {% endfor %}

{% endfor %}

The Title returns fine, but nothing else. First time I have used relatedTo and guess there is something I don't understand about usage. Any advice greatly appreciated!
Roi

**Tags:** relatedto

> **Comments:**
> **username_1**: Are you trying to just get the author of an entry? Or are you trying to get every user in any user field that might be attached to an entry?  
> **username_0**: Just trying to get the author's details, e.g. first name, etc.  I got it to work with the code below, but would still like to understand why my original code does not work.   {% for entry in craft.entries.section('englishProficiencyTranslator').limit(1) %} {{ entry.author }}  {% set au = entry.author %} {% set person = craft.users.email(au) %} {% for details in person %}   {{ details.firstName }}  {% endfor %}   {% endfor %}  
> **username_1**: Added an answer.  

---

## 1 answers

### Answer by username_1 on 2016-07-13. Score: 2

If you're just looking to get the author of an entry, it's a simple as:
{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {{ entry.author.firstName }} {{ entry.author.lastName }}

{% endfor %}

If you're looking to get every user associated with every Users field for an entry, your relatedTo syntax will work:
{% for entry in craft.entries.section('blog').limit(1) %}

    {{ entry.title }}

    {% set allRelatedUsers =  craft.users.relatedTo(entry) %}

    {% for user in allRelatedUsers %}
        {{ user.firstName }} {{ user.lastName }}
    {% endfor %}

{% endfor %}

The reason that returned nothing in your original question is because the "author" field isn't a proper Users field type - it's more of a special case user field.

> **Comments:**
> **username_0**: Thanks, Brad - the first example you gave does exactly what I wanted. The second example is identical to my original code and does not return anything, so would still like to understand why.  
> **username_1**: The last sentence of the answer explains why. Let me know if it's not clear.  

---

