Discourse Voting

Summary: This plugin is the result of the spec put together by @erlend_sh. It gives you the ability to vote on topics in a specified category.

:link: GitHub: GitHub - discourse/discourse-voting: Adds the ability for voting on a topic within a specified category in Discourse.
:arrow_right: Install: Follow the plugin installation guide.

Features

To enable it, edit any category, look on the settings tab for the “Allow users to vote on topics in this category” checkbox:

Once enabled, a “Votes” item is available in the top menu. The topics in that category can be voted on with the count of votes added next to the topic title.

The vote count is also included next to the title when scrolled.

To make it easier to see vote counts from a topic list, the vote count is also added under the topic titles.

Here are the views you’ll see given different states of the user and topic:

There is also a section in the user’s profile page that displays their active votes:

Configuration

A few points about the backend:

  • The number of active votes is configurable and defaults to 10.
  • If the topic is closed or archived, the votes are released to the users and can be applied to other topics but the vote count on the topic remains.
  • If a topic is re-opened or unarchived, the votes are reclaimed and applied back to the users active vote count.
  • If a topic reclaims the votes of a user and they go over their limit, they simply need to wait until topics are closed or archived to allow them to vote again.

CHANGELOG

TODO

  • Create a section for the user to see their active and archived votes.
  • Allow moderators/staff/admins to see who has voted on a topic.

NOTES

In the categories where the Voting plugin is activated, Likes are automatically deactivated. Some sites may want to use both functions at the same time to like replies, see how to re-enable Likes.

EXTRAS

Data Explorer Queries

List people who voted for a topic along with their email addresses:

--[params]
-- int :topic_id

SELECT
dvv.user_id,
email
FROM discourse_voting_votes dvv
JOIN user_emails ue ON ue.user_id = dvv.user_id
WHERE topic_id = :topic_id
AND ue.primary = true
105 Likes
Suggestion: display vote/like counter in main page
Displaying "Likes" more prominently
Plugin: Feature voting separated from Likes
Building an Amazon Discourse pilot, planning for scale
Two new plugin outlets - user_activity_bottom and user_menu_glyphs
Overwriting controllers in plugin
Are there Upvotes/Downvotes, Score for the Posts?
Voting vs Likes for feature requests
Alternative Voting Category Style
Poll in restricted topic where users can’t reply
Question Answer Plugin
A new versioned API for client side plugins
Mounting widget in raw template?
Sort topics on frontpage daily by Votes
How can I make a Discourse forum as "reddit like" as possible
Thoughts on a plugin which turns discourse into stackoverflow
Introducing ProCourse
Promote or demote suggestions
Rake task for merging users
Liking own posts — a specific use case of discourse
UserVoice vs Discourse
Votes not being released after close
Show votes in post list "totals" columns
Multiple Choice Poll questions
Is Decision Making Possible on Discourse?
Advice for getting my little game dev community "out there?"
I need someone who can install a voting plugin
Looking to switch from Vanilla, and have a few questions
Comment on a question instead of answering it
Ranking of post, based on user upvotes
New Theme: Tag-Pages Navigation
New Theme: Tag-Pages Navigation
Ratings instead of Hearts for Likes
Views counter specification
Excluding Suspended, Silenced and Suspect Users When Exporting
Additional Appreciation buttons next to "Likes": "Insightful", "Actionable"
Topic Voting plug-in
Marked as solved, Vote Replenishing & Querying
'How's my driving' plugin?
Delegate poll votes to another person/persons
Can posts be rated or voted on?
Unable to see 'Like' button in the first post/topic
Customize # of Votes per User
Why do official plugin topics auto-delete responses?
Show total votes next to total replies, views and activity columns
How to re-order (or hide) "Votes" and "My Votes" top menu list items?
Would it be possible to store voting data in a json file?
Notice: testing Discourse Reactions here on meta for 1 week!
Muted topics still notifying me on Meta
Hook for a topic's category id?
Multiple topics in single API request
Some plugins not working after upgrade
A tour of how the Widget (Virtual DOM) code in Discourse works
Plugin: Feature voting separated from Likes
Wanted: Discourse Hacker News Plugin
Restricting poll creation to Trust Levels
Prospective Feature: Highlight Posts That Surpass Defined "Likes" Threshold
Is it possible to do Uservoice style voting with the voting plugin
Question Answer Plugin
Approach to a Nominate Post Button?
Is there any plugin for downvoting questions and replies in Discourse
Feature request: Poll with ability for user to add their own options
ProCourse Support
Some things I've built which you can use
Topics that were voted on disappear from user profile after being closed
Discourse as a Virtual Conference Platform
Voting/ideation feature

Is the voting plugin altering the “Top” algorithm when enabled? Do votes affect how voted topics rank in the Top list?

Whether Voting influences Top or not, it would be useful to clarify it in one sentence or so in the plugin description.

It’s a detail, but I guess I’m not the only one wondering when having Votes and Top next to each other in a category.

Have you seen the top topics formula detail? The algorithm for Top is detailed in that site settings, just filter for top topics /admin/site_settings/category/all_results?filter=top_topics

So, I don’t think it is affected by the voting plugin.

2 Likes

I was hoping I would be able to leverage this for challenges, but I am afraid it’s very closely tied to the topic object. Whereas my system will turn on an image that’s already within a post. Technically, it should be possible to store voting data in a JSON file somewhere, no? Since discourse is essentially all JSON.

Is there a way to know how many users have cast how many votes in a Discourse instance using this plugin?

This would be for a monthly report. For this reason, it would be good if the query could be made also for a time range.

1 Like

Data explorer would be how you figure this out today. All the data is in tables.

5 Likes

Hi again! I just wanted to bump my issues. I noticed two bugs while experiementing with archiving:

  • You can vote on archived but open(not closed/locked) topics
  • Closing, then archiving, then reopening the topic causes the vote to be reclaimed while it is still archived. Afaict this is inconsistant since archiving releases the vote, so it shouldn’t release the vote while the topic is still archived

Anyways, thanks for the great plugin!

1 Like