Forum Discussion

BekaD12's avatar
BekaD12
Helper
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>

 

  • BekaD12,

    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.
  • BekaD12,

    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.
    • BekaD12's avatar
      BekaD12
      Helper

      Hi Parshant,

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