I apologize for such a dirty job.
[nodebb-plugin-category-sort-by-votes] Sort topics by votes within a category!
wktang last edited by wktang
NodeBB allows you to sort posts by votes in a topic, but within a category you can't sort topics by votes.
This plugin allows you to sort topics by votes within a category. See screenshot below, you get a little "Most votes" selection from the "Sort by" dropdown menu.
Install it from NodeBB Admin Panel, or
npm install nodebb-plugin-category-sort-by-votes
Go to the ACP (Admin Control Panel).
Activate plugin and reload NodeBB.
Click Plugins -> Category Sort to go to the Plugin's settings.
Click "Re Index" to index all topics (see below screenshot).
Go to any category, select "Most votes" from the "Sort by" dropdown and it should work!
Feature of sorting by votes use
cid:[cid]:tids:votesas key, while it is not supported by NodeBB. So we must recreate the index to make it work.
If "reindex" is not applied before you use "Sort By Votes" option in the category page, the category page will be blank.
We also use
action:post.upvotehook to listen user actions and dynamically update the sortedSet which use
Just an FYI we are building this into core https://github.com/NodeBB/NodeBB/issues/6158, it will deprecate this plugin and 2 forks https://github.com/dangerusslee/nodebb-plugin-category-sort-by-votes-next and https://github.com/jimmykane/nodebb-plugin-category-sort-by-votes-next