Extension talk:Ratings

About this board

Fatal error: Class 'Parameter' not found at "RatingsVoteSummary.php" on line 47

Suriyaa Kudo (talkcontribs)
Jeroen De Dauw (talkcontribs)

This extension is not maintained and does not work with the latest version of Validator. Do not use it.

Reply to "Fatal error: Class 'Parameter' not found at "RatingsVoteSummary.php" on line 47"
Vlsergey (talkcontribs)
 * Get top N elements for some rating
 * @file
 * @ingroup Extensions
if ( !defined( 'MEDIAWIKI' ) ) {

$wgHooks['ParserFirstCallInit'][] = 'wfRatingsTop';

 * Register the new <ratingstop /> parser hook with the Parser.
 * @param $parser Parser: instance of Parser (not necessarily $wgParser)
 * @return Boolean: true
function wfRatingsTop( &$parser ) {
	$parser->setHook( 'ratingstop', 'getRatingsTop' );
	return true;

 * Get top N elements for some rating
 * @return String: HTML
function getRatingsTop( $input, $args, $parser ) {
	global $wgMemc, $wgUploadPath;

	$dbr = wfGetDB( DB_SLAVE );

	if (!isset($args['tag'])) {
		return "<b>Tag must be specified</b>";
	$tag = $args['tag'];
	$limit = !isset($args['limit']) ? 10 : intval($args['limit']);
	$desc = isset($args['desc']) ? ' DESC' : ''; 

	$res = $dbr->select(
			array( 'votes', 'vote_props', 'page' ),
					'page_title', 'avg(vote_value) vv', 'count(vote_value) vc'
					'page_id=vote_page_id','vote_prop_id=prop_id','prop_name' => $tag,
			array( 'GROUP BY' => 'page_namespace, page_title', 'ORDER BY' => 'vv' . $desc . ', vc DESC', 'LIMIT' => $limit )

	$ratingsTopItems = array();
	foreach ( $res as $row ) {
		$ratingsTopItems[] = array(
				'page_namespace' => $row->page_namespace,
				'page_title' => $row->page_title,
				'vv' => $row->vv,
				'vc' => $row->vc

	$comments = '<ul>';

	foreach ( $ratingsTopItems as $item ) {
		$title = Title::makeTitle(

		$comments .= '<li class="ratings-top-item" data-mark="' . round($item['vv'] + 1, 2) . '" ' . 
				'data-count="' . $item['vc'] . '" >';
		$comments .= '<a href="' . $title->getFullURL() . '"' .
				' title="' . $title->getText() . '">' . $title->getText() . '</a>';
		$comments .= '</li>';
	$comments .= '</ul>';

	return $comments;
Reply to "Top10 ratings output"
Thorncrag (talkcontribs)

I think I made the false assumption that casted votes would be setting a semantic property for the pages they were contained on, so it seems they can't be queried using SMW. Am I missing something, or is there no way that we could query pages in order to produce useful reports? This seems to be a feature that is genuinely missing from this extension (and when I say missing, I mean missing). For instance, producing a list of pages with low votes to give contributors targets to pursue. Otherwise, I love the simplicity of this extension and it's a great foundation for additional development, so thank you for getting it started.

Jeroen De Dauw (talkcontribs)

The rating extension has no integration whatsoever with SMW and on top of that is not finished.

Thorncrag (talkcontribs)

Okay, I saw your name and I saw "property" and like I said, made a false assumption! 8-)

Rotsee (talkcontribs) (talkcontribs)

Two more SMW related thoughts...

  • Integration with SMW to build a property value based on the cumulative voted score (can have multiple per page, each as its own property), updating as users contribute their own vote, that can then be used to sort query results that include this property value to only show results that have a rating score >= 4.0, etc.
  • Option for admin to nullify the value somehow to reset the voting process.
Reply to "More about properties" (talkcontribs)


I installed this interesting extension and tried calling the rating function on some pages. However, the star-graphics are not being showed, only the cancel graphic. I am confused, as a look into the code showed me the same directory and the graphic files are in there.

Further I put "Quality" as text, but this is not shown. I actually would like to have a rating for 1.quality and 2.completteness.

Can anyone help me?

Reply to "stars invisible"

Status of this extension

Rotsee (talkcontribs)


what is the current status of Ratings? The ”Some outstanding issues need to be resolved first”-message has been there for quiute some time... rotsee (talk) 05:37, 20 June 2012 (UTC)

Jeroen De Dauw (talkcontribs)

It has not changed.

Rotsee (talkcontribs)

I take it that this is not something you are busy with at the moment? I am trying it now, but contemplating whether it is a bad idea to start relying to much on it. rotsee (talk) 18:47, 20 June 2012 (UTC)

Jeroen De Dauw (talkcontribs)

I have no time to finish up or maintain this extension now and do not expect to have this in the near future.

Rotsee (talkcontribs)

Ok, thanks for the reply, it's helps knowing!

Reply to "Status of this extension"

Changing the label of the stars

Fabianoaguiarg (talkcontribs)

How can I do this? I want to change the label to: Poor, Fair, Average, Good and Excellent. Only the user's view, keeping the numerical value in the database. Thanks!

Reply to "Changing the label of the stars" (talkcontribs)

After the vote and refresh, the summary page is not updated. The summary is only updated if I edit the page and save again. Can anyone help me? (talkcontribs)

Problem solved. Ratings.settings.php

  • Set to true to invalidate the cache of pages when a vote for them is made.
$egRatingsInvalidateOnVote = true
Reply to "Refresh Summary" (talkcontribs)

What extensions are used in this discussion page? It was very organized.

Reply to "Extensions Here" (talkcontribs)

The first star shows the value 0. The second star shows the value 1. And so pro on. In the database is also written with a point less.

Reply to "a bug or my mistake?"

Axe the position:fixed to fix stars position

Thorncrag (talkcontribs)

Fixed should be relative (or static):

 Ratings\starrating\star-rating\jquery.rating.js (1 hits)
 Line 88: 				rater = $('<span class="star-rating-control" style="position:fixed" />');
Reply to "Axe the position:fixed to fix stars position"