Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-23T22:11:54.693Z
Answers.Text: Brilliant! Figures it was way easier than I thought. Thanks Brad! 
Answers.UserDisplayName: Noah Yamen
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-23T22:09:10.017Z
Answers.LastActivityDate: 2017-03-23T22:09:10.017Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <plugin-elementapi>
Title: ElementAPI: Include author/user data with entry?
ThreadText: # 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/<entryId:\d+>.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 username_1!   
  
  ---
  
  