Forum Discussion

Inactive User's avatar
Inactive User
5 years ago

Kudos leaderbord

I come to an understanding that we have to use rest api v1 to filter kudos on a period of time (one month) on my exemple.

I would like to filter my leaderboard by role and exclude some, is it possible ?

<#assign top_users = rest("/kudos/authors/leaderboard?max_age=one_month").users />
<#list top_users.user as user>
<#assign userAvatar = rest("/users/id/${user.id}/profiles/avatar/url").value />
<#assign userInfo = rest("2.0","/search?q=" + "SELECT view_href, login FROM users WHERE id = '${user.id}'"?url).data.items />
<#assign userKudos = user.mixin.kudos.weight />
</#list>

 

  • Inactive User,

    Only possibilities is by using admin settings. If you use API to explore it will take several queries which can impact performance to the page..

    To exclude users by role from Kudos leaderboards: 

    1. Go to Community Admin > Features > Kudos > Settings.
    2. For each leaderboard, go to the appropriate "Roles to exclude" list and enter the names of the roles to be excluded.
    3. Enter role names separated by commas. The settings are:
      • Top Kudoed Authors component: Roles to exclude
      • Top Kudoed Posts component: Roles to exclude
      • Top Kudos Givers component: Roles to exclude
    4. Click Save.

2 Replies

  • Inactive User,

    Only possibilities is by using admin settings. If you use API to explore it will take several queries which can impact performance to the page..

    To exclude users by role from Kudos leaderboards: 

    1. Go to Community Admin > Features > Kudos > Settings.
    2. For each leaderboard, go to the appropriate "Roles to exclude" list and enter the names of the roles to be excluded.
    3. Enter role names separated by commas. The settings are:
      • Top Kudoed Authors component: Roles to exclude
      • Top Kudoed Posts component: Roles to exclude
      • Top Kudos Givers component: Roles to exclude
    4. Click Save.
  • Inactive User's avatar
    Inactive User
    5 years ago

    Hi Parshant,

    Thanks for the quick answer, it's exactly what i needed.