Extension:CommunityVoice

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
CommunityVoice

Release status: unmaintained

Implementation Special page, Tag
Description Allows to place a ratings scale anywhere in a wiki page for users to give 1-5 star ratings
Author(s) Trevor Parscal (Trevor_Parscaltalk)
Latest version 0.1.0
PHP 5.3+
Database changes Yes
Tables cv_ratings_votes
License GPL
Download
Example old WMF Usability Initiative, Wikimama
Tags
* ClientSide
Hooks used
BeforePageDisplay

LoadExtensionSchemaUpdates

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

Check usage and version matrix; code metrics

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.

Installation[edit | edit source]

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

  • Download and extract 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.
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Usage[edit | edit source]

The syntax to use is ClientSide.

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

Example:

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

Alternate syntax (works with templates):

{{#tag:ratings:scale||category="Articles"|title="{{PAGENAME}}"}}

Tips[edit | edit source]

Receiving an error[edit | edit source]

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 | edit source]

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 | edit source]

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 | edit source]

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 | edit source]