Template:RatingWidget- displays rating widgetTemplate:RatingWidgetAutoedit- renders a single star with an autoedit linkTemplate:Rating- stores rating data in the Rating namespaceTemplate:GetUserRating- utility, fetches user ratingTemplate:GetAverageRating- fetches average page ratingTemplate:GetVotesCount- fetches votes countTemplate:GetPageID- utility, fetches page idForm:Rating- processing formProperty:Rating subject- stores related rating pageProperty:Rating user- stores user rated a pageProperty:Rating value- stores rating value
Import pages contents respectively to their namespaces, or use PagePort extension for easier importing:
git clone https://github.com/WikiTeq/mediawiki-ratings.git ~/mediawiki-ratings
cd /mediawiki
php extensions/PagePort/maintenance/importPages.php --source ~/mediawiki-ratings
Import page contents as a package using PageExchange extension:
- Make sure you have the PageExchange extension installed
- Add the following line to the bottom of your
LocalSettings.phpfile:$wgPageExchangePackageFiles[] = 'https://raw.githubusercontent.com/WikiTeq/mediawiki-ratings/master/page-exchange.json'; - Navigate to
Special:Packages - Hit
Installon the package card - run
php maintenance/runJobs.php
The simplest use case is to add a {{RatingWidget}} template call to a page.
This will render a 5 star rating widget allowing users to vote for the page rating.
Once votes the template will create a Rating:1234/USERNAME page with vote information stored there.
Properties stored are:
Subject- page the vote relates toRating- a number 1 to 5, the vote valueUser- the username of the user voted
The RatingWidget template has optional parameters:
{{RatingWidget}}- simply renders a voting widget for the current page on the current page{{RatingWidget|readonly}}- renders a windget for the current page in a readonly mode ( eg.: if you need to display page rating within providing ability to vote ){{RatingWidget|readonly|AnotherPage}}- same as above, but display the rating ofAnotherPagetitle
see RatingExamples page for details