Forum Discussion

waldemarhelm's avatar
waldemarhelm
Director
2 years ago

Custom Components "Most Kudos From" and "Most Kudos To"

Hi,
I want to display in a custom component on a user's ViewProfilePage which three users gave him the most kudos, including avatar and number of kudos.

And in a second component, I want to show, conversely, which three users this user gave the most kudos to.

Can this be done using the API, and if so, how?

Best regards
Waldemar

  • GakuS's avatar
    GakuS
    Khoros Staff

    Hi waldemarhelm , you may need to do more heavy lifting with LiQL and logic on your custom component, but perhaps you could start with the user's kudos_given and kudos_received (API Reference)? 

  • waldemarhelm 

    Here you go 

    SELECT login,kudos_received.sum(weight) FROM users ORDER BY kudos_received.sum(weight) DESC
    SELECT login,kudos_given.sum(weight) FROM users ORDER BY kudos_given.sum(weight) DESC

     

    • VikasB Thanks for that idea. But this will not be solution for the ViewProfilePage context. What waldemarhelm is looking for is an solution to find those data in relation of an given user. With your LiQILs you will only be able to get those data in community context.

      Try this for example and you will always get only one object, the object of the given user.

      SELECT login,kudos_received.sum(weight) FROM users WHERE id = '47160' ORDER BY kudos_received.sum(weight) DESC

      Do you have any other ideas how to get the kudos_received and kudos_given values for an specific user?