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)

84 Likes

I hope this plugin will remain a plugin and never be integrated into core. It may work for some communities, but I fear it changes the incentives for participation to something that most adult communities will not want.

3 Likes

Rest easy, there are currently no plans to adopt this plugin into core. :slight_smile: However, even if it was, you would still be able to turn it off if you didn’t think the feature was suitable for your community. :+1: :slight_smile:

8 Likes

I worked on this. Here is the link for the PR:

6 Likes


On my machine, the resolution already looks good enough. Do we still need the higher resolution avatars?

For this one, we want the link to the Global Leaderboard, right?
It looks like deleting the Global Leaderboard on the plugin is possible. If the Global Leaderboard is deleted, where do we want the link direct the user to?

Is ‘custom per-badge’ referring a new setting that you can choose when you create new leaderboard? Or is it referring that we just want to add per-badge scoring to one of the scoring method?

7 Likes

Awesome, will review this week!

At the moment we are loading a 120x120 image and displaying it 184.583x184.583 for the top1 and 139.65x139.65 for second and third place.

Since this is under active work in

Maybe what we need is a largest option to return larger images, so we can replace the current huge one.

7 Likes

I believe @Falco had the ability to define a per-badge weight per leaderboard in mind.

  • Visit leaderboard form in admin panel
  • Select a badge from a badge selector dropdown
  • Assign said badge a custom weight that is applied on a per leaderboard case.

That sound right?

3 Likes

Yes, this should link to the global leaderboard. The scores in the user card are not leaderboard specific so it should link there. Though a useful feature would be to allow a Featured Leaderboard or something like this to allow some flexibility for admins to decide on what score is displayed.

If the global leaderboard is deleted we should not link to anything, just render the scores as they currently are (not clickable).

3 Likes

I worked on this. Here is the link for the PR:

I am also thinking about adding a feature that highlights the user’s username and score on the leaderboard. What do you think about it?

4 Likes

That would be super cool, but pretty complex. If you click on a link to the 900th user on the leaderboard, you have to load the correct page of users, and then allow infinite scrolling back up to the 1st user


Instead, I wonder if clicking on a user’s link should bring that user up to the top under your row, so we don’t have to mess with scrolling.

6 Likes

3 posts were split to a new topic: Why have my cheers tripled?

4 posts were split to a new topic: Allow for decimals in point values

Hey, tks a lot for this plugin.

Wht do you think about adding users who answer a poll in the score? (ie: aggregate this action with the like given score value).

On my side, that would be terrific!

2 Likes

3 posts were split to a new topic: Allow to view scoreboard by ‘Today’ or ‘Week’

I do agree! I am waiting for this feature but probably it will take time to have it

2 Likes

That’s already in the roadmap of planned features in the OP:

5 Likes

Oups: sorry i haven’t double checked that.
Tks a lot for your response.

1 Like

@GH_Nam, I think this commit blanks out the name if a user doesn’t have a full name set:

6 Likes

Oh no, I will work on this!

2 Likes

For this one, is it possible to ask for a guidance for where to work on?
I am not sure if I should makes changes only to the Gamification plugin, or the Reaction plugin as well. Since not every site uses the Reactions plugin, is it okay to include settings about reactions in the gamification plugin?

2 Likes