# Show a user's reputation/user level next to their name

**URL:** https://meta.discourse.org/t/show-a-users-reputation-user-level-next-to-their-name/29459
**Category:** Feature
**Created:** [May 30, 2015, 8:05pm UTC](https://meta.discourse.org/t/show-a-users-reputation-user-level-next-to-their-name/29459 "2015-05-30T20:05:22Z")
**Posts on this page:** 1
**Showing post:** 17

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [August 22, 2016, 12:41am UTC](https://meta.discourse.org/t/show-a-users-reputation-user-level-next-to-their-name/29459/17 "2016-08-22T00:41:19Z")

</div>

Hello, I just wanted to share my findings. Its not plugin ready, just quick hack to core files (sorry). But as inspiration for someone it may be handy…

## Add User Post Count in post template and user-card

Use as example. It can be adjusted to display various user stats (post count, user\_last\_seen\_at, etc.) in user-card and in post stream.

**app/assets/javascripts/discourse/templates/user-card.hbs**

`{{user-reputation post_count=user.post_count}}`

**/assets/javascripts/discourse/components/user-reputation.js.es6**

```
    export default Ember.Component.extend({
      tagName: 'div',
      classNames: ['user-reputation-user-card'],

      render: function(buffer) {
        
        const post_count = this.get('post_count');
        const contents = '<b>' + post_count + '</b>'; 
        
        buffer.push(contents);
      }
    });

```

**/assets/javascripts/discourse/initializers/user-reputation-init.js.es6**

```
    import { withPluginApi } from 'discourse/lib/plugin-api';
    import { includeAttributes } from 'discourse/lib/transform-post';
    import { h } from 'virtual-dom';

    export default {
      
      name: 'user-reputation-init',
      
      initialize(){
        
        withPluginApi('0.1', api => {
          api.includePostAttributes('user_last_seen_at'); // (automatically added to transform-post.js.es6)
          
          api.decorateWidget('poster-name:after', function(helper) {
            const attrs = helper.attrs;
            const user_custom_fields = attrs.user_title;
            const post_count = attrs.post_count;
            return [h('span', 'post_count ' + post_count)];
              
          });
        })
      }
      
    }

```

**app/serializers/user\_serializer.rb**

```
                  :user_fields,
                  :topic_post_count,
                  :pending_count,
    + :post_count,
                  :profile_view_count

```

**app/serializers/post\_serializer.rb**

```
                  :via_email,
                  :is_auto_generated,
                  :action_code,
                  :action_code_who
    + :post_count,

    + def post_count 
    + object.try(:user).try(:post_count)
    + #object.try(:user).try(:user_stat).try(:post_count)
    + end

```

---

_[View the full topic](https://meta.discourse.org/t/show-a-users-reputation-user-level-next-to-their-name/29459)._
