Extension:RatePage

The RatePage extension enables readers to rate pages on a wiki. It also provides a functionality for setting up and managing contests in which users rate pages.

On desktop skins (currently tested under Monobook, Vector and Timeless) it adds a widget in the sidebar that allows readers to choose any of five available ratings for a page. The extension also works on Minerva and Timeless in mobile mode (using Extension:MobileFrontend, adding the widget in the footer. The extension is configurable and allows for disabling of the default frontend and potentially using a different one. The main functionality is provided via an API module and the data is stored in a custom database table.

Configuration

 * $wgRPRatingAllowedNamespaces: Array of namespace IDs that are allowed to be rated. Default is null, which allows all namespaces. An empty array means no namespaces are allowed.
 * $wgRPRatingPageBlacklist: Array of page titles that are not allowed to be rated. Default is an empty array. You may want to add the main page to the blacklist.
 * $wgRPSidebarPosition: Integer indicating where in the sidebar should the widget be placed (one-based index). Default is 2, which places the widget directly under the first (default) sidebar section.
 * $wgRPFrontendEnabled: Bool indicating whether the default frontend module should be loaded. Default is true. Disable this if you want to write your own custom JS script for voting.
 * $wgRPAddSidebarSection: Bool indicating whether to add the default sidebar section for the widget. Default is true. Disable this if you want to write your own custom JS script for voting and you don't want to rely on the extension adding a section to the sidebar.
 * $wgRPRatingMin: Minimal allowed rating. Default is 1. You may want to change that if you decide to remove the default frontend module and write your own that for example allows for only three different ratings.
 * $wgRPRatingMax: Maximal allowed rating. Default is 5.
 * $wgRPUseMMVModule: Whether to use the optional MultimediaViewer feature. Default is true.
 * $wgRPEnableSMWRatings: Whether to save page's rating as Semantic MediaWiki properties. Default is true. See the section on SMW for more details.
 * $wgRPEnableSMWContests: Whether to save page's contest ratings as Semantic MediaWiki properties. Default is true. See the section on SMW for more details.

Rate limiting
RatePage supports rate limiting for its API. For more information about $wgRateLimits and how to set it up, read Manual:$wgRateLimits, the action key is.

Sidebar cache
RatePage does not function properly with sidebar cache enabled. It is disabled by default, but if you have it enabled, you should disable it through the $wgEnableSidebarCache configuration variable.

Contests
RatePage comes with a functionality that lets you set up "contests" during which users vote on pages on your wiki, but these votes are not counted towards the page's general score. They are kept separately from the main score.

These contests are defined on a special page by users with adequate permissions.

Administration
All administration of contests is done through the Special:RatePageContests page. There one can define new contests, edit existing ones and view contest results. There is no way to delete a contest once it was created, but this feature will probably be added in the future.

For each contest one can specify a unique ID that cannot be changed later and a human-readable description. A contest can be also disabled or enabled to quickly turn on/off the ability to vote for everyone. For each contest there are two permissions that can be granted to any subset of a wiki's user groups: can vote and can see results. For example you can let everyone vote in a contest (even anons), but don't let them see contest results to avoid biased voting.

One can also view the results of a contest in a table with each page assigned a mean score, score count and the number of votes for each score.

Adding a rating widget
The only user friendly way to access the contest feature is to embed a voting widget in a page using the  parser function.
 * First (required) parameter is the title of the page you want to rate.
 * Second (optional) parameter is the contest ID that you want to use. You can use one contest ID for as many pages as you like. A contest ID must only contain digits and lower- or uppercase latin letters. If you don't specify a contest ID, the widget will be linked to the main score of the page.
 * Optional  parameter can be used to specify the width of the widget on the page.

For example  will yield a voting widget 250 pixels wide, that will let you rate the Main Page within contest CONTEST1.

User rights
You can control access to the contests administration panel through the use of the $wgGroupPermissions configuration variable in your LocalSettings.php file.

MultimediaViewer
If you have installed the MultimediaViewer extension, a rating widget will be automatically added to the MMV information panel on desktop skins. You can find it by simply scrolling down on the preview of the file.

In order for this to work, you have to load RatePage after MultimediaViewer in your LocalSettings.php file.

You can disable this feature using configuration settings.

Semantic MediaWiki
If you have Semantic MediaWiki installed, RatePage lets you optionally save the ratings as SMW properties (see: ).

Data in these properties is not updated after every vote, but only after a data update is performed on a page (for example when someone edits it or its parser cache expired). Thus, it can be used as a means of accessing the rating data using wikitext, but there's no guarantee the data is up-to-date. This can be useful when producing page rankings or displaying contest results.

Main score
The main score is saved using two built-in properties: Average rating and Ratings count. They are both rather self-explanatory. The Average rating property is set only on pages that have been rated at least once.

Contest scores
For a contest's score to be saved as a SMW property, its results have to be first viewable to everyone. This can be set in the contest management panel. The scores are saved as subobjects of the page, with every subobject corresponding to one contest. Such a subobject consists of three properties: RatePage contest identifier, Average rating and Ratings count.

action = query & prop = pagerating
Adds information about page ratings in a specific contest to the query module.


 * Parameters
 * : Contest ID (optional). If not specified, the API will assume you mean the main score of the page.


 * Example

The  and   fields indicate whether the user can vote and see the results of this contest.

action = ratepage
Allows a user to rate pages and retrieve all votes that have been submitted so far.


 * Parameters
 * : The id of the page
 * : The title of the page (you must specify either  or
 * : Your rating of the page (optional). If you do not specify the  parameter, the API will just return the current votes.
 * : Contest ID (optional). If not specified, the API will assume you mean the main score of the page.


 * Example