# Adding user attributes to the directory item serializer

**URL:** <https://meta.discourse.org/t/adding-user-attributes-to-the-directory-item-serializer/130927>\
**Category:** Development\
**Created:** [October 14, 2019, 6:45am UTC](https://meta.discourse.org/t/adding-user-attributes-to-the-directory-item-serializer/130927 "2019-10-14T06:45:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [October 17, 2019, 7:30am UTC](https://meta.discourse.org/t/adding-user-attributes-to-the-directory-item-serializer/130927/4 "2019-10-17T07:30:25Z")

</div>

How about making the user directory serializer accept a new parameter like `users.json?include_profile=true`

Then we can add a JS plugin API which allows themes to add this parameter:

```js
api.userListIncludeProfile(true)

```

“Profile” would include all the things in the regular user serializer (being careful not to introduce n+1 queries). I don’t think specifying individual fields is going to make much difference to performance, so IMO we should keep it simple.

The same approach could work for topic lists as well `?include_excerpts=true`

I also like this because it means the “per-theme serializer configuration” won’t get broken by the anon cache!

What do you think @sam?

---

_[View the full topic](https://meta.discourse.org/t/adding-user-attributes-to-the-directory-item-serializer/130927)._
