<p><code>$entry-&gt;author</code> is going to be a <a href="https://craftcms.com/classreference/models/UserModel" rel="nofollow noreferrer">UserModel</a> object, so you've got access to all of its properties and methods depending on what you need to return.</p>

<p>i.e. <code>$entry-&gt;author-&gt;firstName</code>, <code>$entry-&gt;author-&gt;lastName</code>, etc.</p>

<p>Here's a list of them from a Twig perspective, but the same things are available to PHP. <a href="https://craftcms.com/docs/templating/usermodel" rel="nofollow noreferrer">https://craftcms.com/docs/templating/usermodel</a></p>

CC BY-SA 3.0
2017-03-23T22:11:54.693Z
Brilliant! Figures it was way easier than I thought. Thanks Brad! 
Noah Yamen
CC BY-SA 3.0
2017-03-23T22:09:10.017Z
2017-03-23T22:09:10.017Z
Brad Bell
<p>Searched around online and couldn't find an answer to this question. I want to be able to include some data from the author/user account associated with an entry. </p>

<p>Here is the basic working version of an individual entry, which does display the 'author' name, but no idea how to display that user's data, such as; profile photo, first name, last name, and custom member fields. </p>

<pre><code>'listings/&lt;entryId:\d+&gt;.json' =&gt; function($entryId) {
  return [
    'elementType' =&gt; 'Entry',
    'criteria' =&gt; ['id' =&gt; $entryId],
    'first' =&gt; true,
    'transformer' =&gt; function(EntryModel $entry) {
      return [
        (int)$entry-&gt;id,
        (int)$entry-&gt;year,
        $entry-&gt;manufacturer,
        $entry-&gt;model,
        $entry-&gt;author
      ];
    },
  ];
</code></pre>

<plugin-elementapi>
ElementAPI: Include author/user data with entry?
# ElementAPI: Include author/user data with entry?

(Asked by: username_0 on 2017-03-23)

Searched around online and couldn't find an answer to this question. I want to be able to include some data from the author/user account associated with an entry. 
Here is the basic working version of an individual entry, which does display the 'author' name, but no idea how to display that user's data, such as; profile photo, first name, last name, and custom member fields. 
'listings/.json' => function($entryId) {
  return [
    'elementType' => 'Entry',
    'criteria' => ['id' => $entryId],
    'first' => true,
    'transformer' => function(EntryModel $entry) {
      return [
        (int)$entry->id,
        (int)$entry->year,
        $entry->manufacturer,
        $entry->model,
        $entry->author
      ];
    },
  ];

**Tags:** plugin-elementapi

---

## 1 answers

### Answer by username_1 on 2017-03-23. Score: 1 | Accepted answer

`$entry->author` is going to be a [UserModel](https://craftcms.com/classreference/models/UserModel) object, so you've got access to all of its properties and methods depending on what you need to return.

i.e. `$entry->author->firstName`, `$entry->author->lastName`, etc.

Here's a list of them from a Twig perspective, but the same things are available to PHP. <https://craftcms.com/docs/templating/usermodel>

> **Comments:**
> **username_0**: Brilliant! Figures it was way easier than I thought. Thanks Brad!   

---

