In a feature discussion titled ‘Idea/Suggestion for an option: Display additionally current Leaderboard Rank’ under the gamification category, jrgong proposed enhancing the leaderboard plugin to show users’ current rank in their user card, with an optional setting to only display top X users to avoid discouraging lower-ranked participants. They also suggested adding customizable CSS classes for user profiles. NateDhaliwal noted that this could be implemented via a Theme Component, referencing the JSON endpoint for leaderboard data (e.g., https://meta.discourse.org/leaderboard/1.json). NateDhaliwal later shared a working solution at https://meta.discourse.org/t/usercard-show-leaderboard-rank/378735. chapoi joked about Nate’s speed, then chapoi confirmed they also built the same solution, calling it potentially overkill but useful for now, while keeping the feature request open for possible future core integration. NateDhaliwal responded with enthusiasm, calling the related images ‘really great!’ The discussion reflects community collaboration to implement a gamification enhancement via theme components while leaving room for future official support.
We are testing the leaderboard plugin and so far it’s really neat!
But based on our and users’ feedback, users wanted to see their current leaderboard rank in their user card.
To not discourage users of lower ranks, there also should be an option to only display the top X users’ ranking, whereas X can be configured in the plugin settings.
Edit: also it would be nice to have additional CSS Classes in the html output for customization in user profiles, just like in the user cards Cheers html output.
This may be able to be done via a Theme Component.
Leaderboard data can be grabbed as a json. For example, https://meta.discourse.org/leaderboard/1.json returns the top 93 users by the ‘Monthly’ period; the default for this leaderboard (the one excluding Discourse Staff is defaulted to ‘Today’).
Anyway, came here to say, yes I made it (Usercard: show leaderboard rank) but it’s probably a bit overkill, and we could keep the feature topic open in case we just allow this via core at some point later.
But, best I could do! Hope you like it (and that it works hehe)