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 [

1 Answer 1


$entry->author is going to be a 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

  • Brilliant! Figures it was way easier than I thought. Thanks Brad! 👍🏼
    – Noah Yamen
    Mar 23, 2017 at 22:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.