Skip to content
Snippets Groups Projects

Extension: RankedChoice

The RankedChoice extension allows users to select pages that show up in a global RankedChoice list on the Special:RankedChoice page.

Installation

  • Download and place the file(s) in a directory called RankedChoice in your extensions/ folder
  • Add the following line to your LocalSettings.php
wfLoadExtension('RankedChoice');
  • Run the update script php <mediawiki-instance>/maintenance/update.php to create the DB tables

Usage

For logged in users, view pages that have included the

{{ #rankedchoice: }}

function hook, and select from one of the options. Then, the choices will show up on the Special:RankedScore page ranked in order by votes.

Parameters

  • $wgRankedChoices - An array of RankedChoice configuration with the following keys:
    • value - The numeric value of a choice (used for ranking)
    • tag - The display tag
    • name - The name for use in the database
    • class - The CSS class for use in the lists (for customization)

The default $wgRankedChoiceChoices is as follows:

$wgRankedChoiceChoices = [
  [
    "value" => 5,
    "tag" => "1st Choice",
    "name" => "first",
    "class" => "first"
  ],
  [
    "value" => 4,
    "tag" => "2nd Choice",
    "name" => "second",
    "class" => "second"
  ],
  [
    "value" => 3,
    "tag" => "3rd Choice",
    "name" => "third",
    "class" => "third"
  ],
  [
    "value" => 2,
    "tag" => "4th Choice",
    "name" => "fourth",
    "class" => "fourth"
  ],
  [
    "value" => 1,
    "tag" => "5th Choice",
    "name" => "fifth",
    "class" => "fifth"
  ],
];

Special Page

This extension creates a new special page called "Special:RankedScoring". This lists all the pages on which choices have been made, and how many of each kind of vote was placed.

Rights

  • 'rankedchoice' - Accounts who have the rights to use RankedChoice can access the interface.:
  • 'rankedchoice-write' - Accounts that can add/remove choices. Accounts that have 'rankedchoice' but not 'rankedchoice-write' will be able to view choices, but not make them
  • 'rankedchoice-admin' - Accounts that can remove other user choices

To enable for everyone, the following to lines should be added:

$wgGroupPermissions['*']['rankedchoice'] = true;
$wgGroupPermissions['*']['rankedchoice-write'] = true;

Internationalization

Currently only has support for English.