Discourse Gamification

:discourse2: Summary Discourse Gamification adds customizable scoring (karma, kudos, points) and leaderboards to your instance.
:hammer_and_wrench: Repository Link https://github.com/discourse/discourse-gamification
:open_book: Install Guide How to install plugins in Discourse
:test_tube: Demo Leaderboard

Features

While Discourse ships, out of the box, with gamification features (badges, trust levels) some communities want to take it to another level. That’s where GitHub - discourse/discourse-gamification comes in.

This plugin allows admins to easily create and tweak community scoring contests, where points are awarded by participating in the community.

Points are automatically updated every 5 minutes for events of the day, and we re-calculate scores from the last 10 days once a day.

Cheers

Users are awarded “cheers” by performing certain actions on the community. Each user cheer score appear on their user card, user profile and can be enabled on the user directory.

user card example with cheers

Like the plugin but the name cheers isn’t the best for your community? You can rename it to anything using Customize all text in Discourse.

Leaderboards

Admins can create multiple leaderboards, and each one can have a custom:

  • start date
  • end date
  • Competing users
  • Leaderboard privacy

By default, we ship with a default leaderboard at /leaderboard that will list all users from the first day where scores started to be awarded.

You can see a demo of it at Discourse Meta

Scorables

Currently, the following events award cheers:

See roadmap for upcoming scorables.

Score backfill

If you want to retroactively award scores you can run the following task:

rake gamification_scores:backfill_scores_from[2000-01-01]

This took under 1 minute to run on Meta for a 10+ years backfill, so it should be quite safe to run on large instances.

If you are using our hosted service for your community contact our support to run a backfill task for you.

Configuration

Global customizations are:

  • each action score multiplier
  • Restrict categories where points can be earned
  • enable and disable the plugin

Those plugin-level settings live at /admin/site_settings/category/plugins?filter=plugin%3Adiscourse-gamification.

To create, delete and update leaderboards, admins can visit /admin/plugins/gamification.

Use as widget

This can also be displayed as a widget in a smaller format, inside the Right Sidebar Blocks theme component. More info to be found there.

Badges based on score

You can have automatic badges based on the gamification score using Enable Badge SQL

Here is an example badge when a user has over 9000 cheers:

SELECT user_id, current_timestamp AS granted_at 
FROM gamification_scores
WHERE (:backfill OR user_id IN (:user_ids))
GROUP BY 1
HAVING SUM(score) > 9000

Changelog

  • 2022-05-02T03:00:00Z - Public Release
  • 2022-05-10T05:00:00Z - Update roadmap with recent changes

Roadmap

(roughly ordered)

  • Fix i18n table title in custom score column on user directory

  • Ignore staged users

  • Ignore anonymized users (email match @anonymized.invalid)

  • Style leaderboard edit form

  • Leaderboard “you” link needs a larger offset to accommodate floating header…

  • Fix highlight of own user on the leaderboard not working if own user position is > 100

  • Add i18n thousands separator to user card / profile cheer score

  • Make leaderboard respect prioritize usernames in ux being disabled

  • Add time period filters to leaderboards

  • Add default time period filter to leaderboard settings

  • Add excluded_groups_ids to leaderboard settings

  • Use higher resolutions avatars in leaderboard podium

  • Make scores click link to leaderboard (both in user profile and user card)

  • Add custom per-badge scoring

  • Allow admins to award/remove arbitrary points to users to allow integration with out-of-Discourse scorable events

  • Add per-reaction score awarding (requires Discourse Reactions - Beyond Likes)

  • Add chat-events scoring (requires Introducing Discourse Chat (BETA))

  • Add poll events scoring (created poll, voted in poll)

  • Add media events scoring (posted image, posted video, posted onebox)

76 Likes

5 posts were split to a new topic: Leaderboard doesn’t show score for recent periods

3 posts were split to a new topic: How to query gamification score via the API?

4 posts were split to a new topic: Personal score isn’t updated when time period changes in leaderboard

5 posts were split to a new topic: How to make a leaderboard only for accepted solutions?

A post was split to a new topic: How to create a new leaderboard for a specific month?

6 posts were split to a new topic: Create badges based on Gamification score

6 posts were split to a new topic: Leaderboard page gives me 404

My apologies but where do I find Leaderboards? I have the plugin installed but cannot find how/where the option is to display and configure leaderboard itself.

3 Likes

Its /leaderboard. For example https://meta.discourse.org/leaderboard.

4 Likes

Okay so to display one we use a link in a post or add say a link to hamburger 4 example?

That being said how/where do we configure an lb as it is stated we can have multiple ones with different stats using different criterias?

Thank you kindly very much appreciate the help.

I do think there is a topic on how to add a button to the hamburger but I don’t have the time to look for it now

I think you can have more than 1 leaderboard by configuring it at https://<domain>/admin/plugins/gamification

1 Like

Okay will take a deeper look. I have seen in plugin settings you can control how much cheers s variety of different actions add. But not sure how you would have a leaderboard display for different boards.

This is a very exciting plugin.


Okay have tested a post with link seems mostly straight forward now. Just need to add a menu link to access it vs posting a link in a message.

Thank you once again for you kind help!! :beers::sunglasses::vulcan_salute:

1 Like

What is the most effective way to obtain cheers? (on any forum with cheers?)

It depends. Since admins can change the values we cant tell you for a specific forum.

5 Likes

While atopic would likely be a good read… Someone long ago created easy to use Theme-component. :vulcan_salute::sunglasses::+1:

Hi,

Is it possible to add points to specific users manually?

Thanks
Noam

3 Likes

It is on the roadmap but hasn’t been implemented yet:

4 Likes

Even if I use API or Data Explorer?

1 Like

Data Explorer is read-only, it never changes data.

An API endpoint to add arbitrary points to users is what is in our roadmap, so it’s not possible yet.

2 Likes