From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type Special page, Tag
DescriptionTemplate:Extension#description Allows to place a ratings scale anywhere in a wiki page for users to give 1-5 star ratings
Author(s)Template:Extension#username Trevor Parscal (Trevor_Parscaltalk)
Latest versionTemplate:Extension#version 0.1.0
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp Yes
TablesTemplate:Extension#table1 cv_ratings_votes
LicenseTemplate:Extension#license GNU General Public License 2.0 only
ExampleTemplate:Extension#example old WMF Usability Initiative, Wikimama
* ClientSide
Hooks usedTemplate:Extension#hook

Translate the CommunityVoice extension if it is available at translatewiki.net

Check usage and version matrix.

The CommunityVoice extension allows an editor to place a ratings scale anywhere in a wiki page, and then users can give 1-5 star ratings. Each ratings scale has a category and title attribute which will later be used by the ratings list tag, displaying top-rated titles in a category. Anyone can view the current rating, however if you are logged in you may also vote.

Has a dependency on Extension:ClientSide that provides functions for generating code in client-side formats such as HTML, CSS and JavaScript.


Note Note: The ClientSide extension needs to be installed first for this extension to work.

  • Download and place the file(s) in a directory called CommunityVoice in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/CommunityVoice/CommunityVoice.php";
  • Run the update script which will automatically create the necessary database tables that this extension needs.
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.


The syntax to use is ClientSide.

  • Category = Specify the properly category.
  • Title = Specify a title reference.
<ratings:scale category="CATEGORY" title="TITLE" />


<ratings:scale category="Extension Survey/Extension Nomination/Editing" title="MarkitUp MW" />

Alternate syntax (works with templates):



Receiving an error[edit]

If you receive an error like:

Error returned by MySQL database is «1146: Table 'YOURWIKI.cv_ratings_votes' doesn't exist (localhost)».

Check your privileges, one of the possibles reasons it is the user have enough rights to create the tables required. Then try to run manually the Initialize.php through the shell. Go to the MediaWiki extensions folder and write the following code.

\php Initialize.php --confirm=yes

This will rebuild the tables required to run the extension.

Using a template to run the extension[edit]

Maybe in the future will be a good way to run properly the extension, it will be using a template, right now it's not possible because the extension don't support variables, it saves the variable value as a value, then it's not correct. Which is to say, the fields included as template parameters cannot be passed through reliably when the user clicks to vote -- eg, {{{1}}} often ends up in the SQL db instead of the title, and an "error sending" message appears on the page. Do not use templates for this!

Create a simple template labeled Votes that contain the following code:

<ratings:scale category="YOURWIKI:Votes/{{{1}}}" title="{{{1}}}" />
CommunityVoice Screenshot

Then to use the extension, it's easy use the template {{Votes|NAME_DESIRED}} and you will see the same thing of the screenshot.

Consider the use of template as a test, but not it to use seriously.

Strange behavior[edit]

When you refresh a page does it contain one rating value, you see <communityvoice-ratings-scale-stats> message instead of the correct message 0 / 5 (0 votes cast). If you introduce several rating values below of this, then the following rating messages are correct, but the first rating show an incorrect message. Right now it's unknown how to resolve this strange behavior.

None of the points above have solved my problem[edit]

If your are reading that, maybe your wiki is not running correctly the CommunityVoice, remember to check the files extension, for example. Sometimes the javascript files extension (.js) are changed to text files extension (.txt), then the javascript file is not executed. It's very particular for the file CommunityVoice.js.txt, if you see this then rename it to CommunityVoice.js.

See also[edit]