[Mediawiki-l] help with rating system

Kathleen Cooch Kathleen.Cooch at dominos.com
Tue May 27 12:34:51 UTC 2008


Hi all
Looking for some help on star rating system.
I'm using Leer wikis' rating system.
my problem is that the voting is based on Ip address
as many of my users log in on the same computer I need to target login not IP
this is the rate article php and I have attached the ratings file as well

thanks in advance for any help
kate


<?php
require('Ratings/_drawrating.php'); 
if ( ! defined( 'MEDIAWIKI' ) )
	die();

//--------------------------------------------------
// See http://www.leerwiki.nl for either updates
// or other extensions such as the Ajax Rating Script-,
// Image shadow- or EditpageMultipleInputboxes extension. 
// good luck with your Wiki! 
// B.Vahrmeijer
//----------------------------------------------------

$wgExtensionCredits['parserhook'][] = array(
'name' => 'AJAX RATING BAR V2.5 25-09-2007 Based on Masugadesign',
'author' => 'Boudewijn Vahrmeijer',
'url' => 'http://www.leerwiki.nl',
'version' => '1.11,1.10.1/1.9.3/1.9.2/1.8.2',
'description' => 'Ajax Rating Bar for MediaWiki',
);

########## Settings ##########
$pathToRating='/wiki/extensions/Ratings/'; //if your path is
www.yoursite.com/wiki than change this to /wiki/extensions

###separate vote from ip ###
function wfAllowVotes(&$out){
	global $wgUser;

if ($wgUser->isLoggedIn() ) return true; //not me:)
 
}

########## Hooks #############
$wgHooks['SkinTemplateSetupPageCss'][] = array("wfAjaxScriptRSS");    
$wgHooks['BeforePageDisplay'][] = array("wfRateArticleForm");


########## Functions #########
function wfAjaxScriptRSS(&$out) {
	global $pathToRating;
$out='/*<![CDATA[*/
			@import
"'.$pathToRating.'/wiki/extensions/Ratings/css/rating.css";
		/*]]>*/';

return true;

}

function wfRateArticleForm(&$out) {
	global $wgArticle,$pathToRating;
	if ($wgArticle == null) return $out;
	
#if ($wgArticle->getTitle()->mNamespace != 0) return  $out;// I removed this
line an made array instead kc
$pagesToRate = array('Inventory', 'Caller ID', 'Pizza Tracker','Create a
profile', 'Routing', 'Digital Dashboard', 'Community Showcase','Training
Slices', 'Topics', 'Training Series','Order Entry', 'How to Create a Coupon',
'Create a page', 'Coupons: Adjustments, Taxability, & the Daily Summary',
'Questions and Answers', 'Main Page', 'Quick Fix', 'Remote Menu Manager 101',
'Domino\'s Pulse
 Reports', 'Labor Management 101'); 

if (!in_array ($wgArticle->getTitle()->getText(), $pagesToRate)) return $out;

	$out->mBodytext.='<script type="text/javascript" language="javascript"
src="'.$pathToRating.'/wiki/extensions/Ratings/js/behavior.js"></script>';
	$out->mBodytext.='<script type="text/javascript" language="javascript"
src="'.$pathToRating.'/wiki/extensions/Ratings/js/rating.js"></script>';
	$out->mBodytext.='<link rel="stylesheet" type="text/css"
href="'.$pathToRating.'../Ratings/css/rating.css" />';
	$out->mBodytext.=rating_bar($wgArticle->getID(),5);

	return $out;

}



?>




More information about the MediaWiki-l mailing list