Extension talk:Rating Bar

There are 2 other talk pages for this extension (as far as I know): Franck Dernoncourt 21:06, 20 April 2009 (UTC)
 * http://www.wiki4games.com/index.php?title=Wiki4Games_talk:RatingBar
 * http://www.mediawiki.org/wiki/User_talk:Patheticcockroach (EDIT: but shoudn't be a talk page for this extension)
 * Seriously, my talk page isn't supposed to be for the extension (although lately I must say it's been used as if it was Extension talk:Rating Bar itself :o, so it may contain answers to questions you may have). Patheticcockroach 21:32, 20 April 2009 (UTC)
 * lol Franck Dernoncourt 21:39, 20 April 2009 (UTC)

Stars or Blocks
Hi, there is a way to change the horizontal bar for stars or blocks (like the source for the extension in mininova)? --Knight Rider 01:53, 10 March 2009 (UTC)
 * Actually, one of the reasons why we made this extension is because we didn't like the star style. You may want to give a try to JSKitRating if you want stars. It's possible that we add a stars option (btw, what do you mean with block like in mininova? I have just been there and didn't see any kind of rating bar), but that's not a current development priority. Patheticcockroach 07:19, 10 March 2009 (UTC)
 * When i said mininova i'm refering the mininova labs script that inspirate your extension. I like your extension, it's great, but the bar with percents is complicated, if have a option to limit the votes in a scale of 1 to 5 or 1 to 10 instead 1 to 100, it will be more simple. PS: sorry my bad english --Knight Rider 18:04, 10 March 2009 (UTC)
 * Oh... if there's still a Mininova labs reference in the extension it's probably that Franck forgot to remove it: he used it to do the first drafts of the extension, then I rewrote the rating bar from scratch. Anyway, these kind of settings (stars; 1 to 10 (or rather, 0 to 10)) are likely to get on our to do list at some point, but not in the near future, since 1) we are focusing on improving the coding style and fixing some remaining defects like the impossibility to place several bars on the same page and 2) we unfortunately don't have much spare time ATM. Patheticcockroach 18:33, 10 March 2009 (UTC)
 * Yep, Minivova's rating bar is great... but doesn't work with MSIE :-/ Franck Dernoncourt 09:15, 11 March 2009 (UTC)

Thanx for this very nice extension. Being able to chose stars or blocks would be great as an option indead of a continous bar. I hope you'll work on it! JSKitRating extension of course has stars but isn't as convenient as your rating bar with, e.g., the possiblity of displaying user's votes. -- 83.77.149.220 13:41, 29 March 2009 (UTC)

I like the pourcentage idea I will use it and I thank you guys for all your hard work. Merci Franck --Kronoxt


 * Stars are now available! You guys did some really good work there... just add (style="stars")

Error: You need to enable javascript to vote
So, I followed the fixes posted over at wiki4games, but still get this error. In the preview of the article, I can see the voting bar. However, when I save it, it goes away, as others have reported. I'm not sure what code I should post to help diagnose :( Are there other adjustments to be made to get this working?  This extension is beautiful by the way and I'm looking forward to getting it working.  Your time is much appreciated. --Wait, so, is this where I should be posting?  Or should I post on wiki4games instead?  This is the extension page right? CaliVW78 14:06, 24 April 2009 (UTC)
 * The place to post is a bit confusing, to make it simple I watch all possible pages anyway ;) The issue you report seems a bit different than what the others reported though (the bar appears when you edit - I don't think this was the case for the others). Still, did you set $site_name to the same value as $wgDBname? Otherwise, well, a link to your wiki +/- your configuration (don't forget to remove passwords) would be nice (reporting a bug/issue is a great occasion to get some traffic :) ). I'll try to publish a dev version this week-end so ppl don't have to bother going around the bugs we've already fixed (most often: session ID cookie and custom extension path). Patheticcockroach 15:18, 24 April 2009 (UTC)
 * My apologies. I am seeing the rating bar without issue, when I do a preview of the page.  When I save it, it goes back to the error. $site_name does indeed match $wgDBname.  This wiki is not public facing, though I may too setup a dev environment to help with these issues, which would be public facing.  Below is my config:

$ratingbar_dbhost                                      = 'localhost'; // Usual 'localhost' $ratingbar_dbuser                                      = 'root'; $ratingbar_dbpass                                      = '******'; $ratingbar_dbname                                      = '******'; $table_prefix                                          = ''; // eg wg_ $site_name                                                     = 'nocwikidb'; // 'yoursitename' if your site is http://www.yoursitename.com $ratingbar_tablename                           = 'ratingbar'; $user_tablename                                        = 'user'; // Table where we check if the user exists. Default value in MediaWiki: user $categorylinks_tablename                       = 'categorylinks'; // Table where we check if a page belongs to a category. Default value in MediaWiki: categorylinks Interestingly enough, you state that $site_name should match $wgDBname. However, in the config file itself, it states that it should be the hostname of the box? In my case the url is http://noc/wiki, but the $wgDBname in my LocalSettings.php file is "nocwikidb" Which should I be using for $site_name ? CaliVW78 06:47, 3 May 2009 (UTC)
 * RatingBar/config.php****
 * I suggest you try version 1.1-dev2, it fixes most reported bugs about javascript not loading. Patheticcockroach 08:18, 3 May 2009 (UTC)
 * Ok, gave 1.1-dev2 a try, with the same results. I am still using a wiki that is not public facing, so I'm not able to give you a url that you can go a look at.  The issue remains though.  An error is displayed stating "Error: You need to enable javascript to vote."  When I do a preview of the article though, the rating bar shows up perfect.  If I vote on the rating bar via the preview page, that value sticks and can be seen on the article page, just above the javascript error.CaliVW78 11:36, 25 May 2009 (UTC)
 * Even I ran into similar issue.... After researching and reading all the discussions, this is what I found. The fix is discussed on under "Jave Script Error with page titles having /". This is what you need to do... (copying it from the original content for your ease). Open config.php of the ratingbar extension and change the following two lines to include additional character '/' and 'Ux2f'

$stupid_characters					= array('&','#','%','/'); $stupid_characters_codes			= array('Ux26','Ux23','Ux25','Ux2f'); Hope this helps. I would still recommend to read the original article in full. Thanks, Neeraj

A few thoughts
Hi, first off I'm happy to see a new serious option to finally go for a rating system. It's all about avoiding abuse and the option to do useful things with the collected data. --Subfader 21:12, 1 May 2009 (UTC)

Average as stars
Display a stars bar, not just a bold average number. --Subfader 21:12, 1 May 2009 (UTC)

My ratings

 * Add a special page called My ratings on which the user can access his ratings. A sortable table with the columns: Rating, Page, Date. The user can do what he wants. All votes are collected but may not be considered on displaying per-page-ratings (see below).
 * On a page display a second rating bar with the user's own rating below the normal bar. (like IMDB) --Subfader 21:12, 1 May 2009 (UTC)
 * It's already possible for a user to display their own ratings, but it's available only by a tag and not a special page yet. Patheticcockroach 07:03, 2 May 2009 (UTC)

All votes per page by others
On the extended rating box add a link to a to a Special Page to see all votes by all considered users for that page. E.g. link the (XX votes). May result a long list for big wikis, but no problem with the standard MW "200 items navigation listing". --Subfader 21:12, 1 May 2009 (UTC)

Adapt IMDB rating system
I'd like to see it behaving like the IMDB rating which is one of the best. For small wikis it may not work out cos if the rating is only displayed after e.g. 5 votes have been received it can take very long till they see ratings, so maybe make that optional or let a few ratios be defined per $wg. --Subfader 21:12, 1 May 2009 (UTC)
 * No stats for a page till X votes have been received.
 * Use the Bayes estimator instead of plain average.
 * For the displayed stats only votes by regular raters are considered. While it's not clear what IMDB uses here. I guess a regular and serious user is one who fits the criteria below. If the the votes by a user are considered after a while let's call him a serious user here. So a user is serious if:
 * Time/ammount ratio:  = the higher the better. The user rated quite a few pages within a long period, but not too many in a short time. If the user registered before the extension was installed, take the date when the extension was installed. After introducing the rating on the wiki or after a user registered he may vote a lot in a short time, but only if he stays active the votes may be considered soon.
 * Value ratio: The user is no pusher (fan or hater). Hard to find rules for that. There might be users who only vote things they like best so if a user votes only 10/10 he should be considered nontheless if he fits other criteria.
 * For all this: Never let the user know if he is in the "list" of serious users. He shall not try to become one. On IMDB you don't know if you influence the votes or not so you just vote seriously for yourself.

DPL integration
I'd like to see the data being accessable using Extension:DynamicPageList (third-party) so all kinds of combinations for lists are possible like the above mentioned "My ratings" page. Example parameters:  (pages with "serious" votes),   (pages without votes). That would be it already I guess since you could combine them with all the standard DPL parameters. --Subfader 21:12, 1 May 2009 (UTC)


 * That's quite a large list of good suggestions, and actually some of these ideas already crossed our minds but were postponed to "later" because we had to make some choices if we wanted to release something within an acceptable delay... The only part I don't really understand is the DPL integration: I didn't know this extension, and I'm not sure of what we'd need to do to make DPL work on Rating Bar. Anyway, adding all this to the (already quite long) to do list. Not sure of when I'll be able to implement it though. Patheticcockroach 06:57, 2 May 2009 (UTC)


 * I didn't expect it to be integrated too soon :) Just wanted to leave my requirements for a good rating extension. I won't go live with any rating system till all this is possible. That's why I never installed one of the simpler extensions. You can't do anything with it than display the avaerage vote on the page. About DPL (third-party): You should give it a try. With the combination of a few commands you can run all kinds of quereys and receive lists or tables of articles, categories or include the complete contet or chapters of articles. If you could querey the rating table you could drop lists such as: all your chart tables, latest comments left, unrated articles, categories with most/no ratings, users who didn't rate 1/5 etc. Here are a few examples. No idea how to work together with DPL, but it can't be more than adding a few commands realted to the rating table. --Subfader 16:58, 2 May 2009 (UTC)

Error: Sorry, MySQL query failed.
Hi, i install 1.1-b1 version, follow all the steps in instalation, but always i try to preview or save a page with rating bar i get the a mysql query failed. I recheck all steps, but don't know what could be happening.--Knight Rider 16:20, 6 May 2009 (UTC)
 * Looks like there is a very weird issue with some non-English wikis: for some reason the variable containing database and table names become empty at some point... someone sent me a back up of his wiki so I can investigate more precisely... I'm not very optimistic about whether I'll find what's wrong though :/ 89.159.167.45 12:33, 30 May 2009 (UTC)

something weird with the scope of variables
Using PHP 5.2.12, I found that something is going wrong with the variables from, which are undefined when functions in doqueries.php need them. Different: why not using the $wgDB.... variables from LocalSettings.php (in config.php) ? --Wikinaut 13:03, 5 January 2010 (UTC)

Semantic mediawiki integration?
Hello, wicked extension I was wondering if this could be integrate to semantic mediawiki?

Fixed some of my issues
I seemed to have a few issues with variables and short URLs. I collectively added a bunch of the fixes (with author notes) I found on this discussion page as well as W4G's discussion page and ultimately got the extension working on my wiki. The file I am using can be found here. BTW, am I allowed to link that? I didn't want to put it on here in pre tags because it made the edit page extremely long. --Glycerine102 04:37, 10 January 2010 (UTC)


 * You could post the code, enclosed in


 * on a subpage User:Glycerine102/ratingbar.php or User:Glycerine102/Ratingbar.php to your user page here on mediawiki. Note, that such page names are case-sensitive. --Wikinaut 09:26, 10 January 2010 (UTC)
 * Thanks, edited original link.Glycerine102 21:13, 13 January 2010 (UTC)

Special Page undefined variable
I seem to be getting the following error on my pages, with the latest version of Rating Bar: Notice: Undefined variable: add_special_page in $IP/extensions/RatingBar/ratingbar.php on line 59 Additionally, I'm getting the error: Warning: Cannot modify header information - headers already sent by (output started at $IP/extensions/RatingBar/ratingbar.php:59) in $IP/includes/WebResponse.php on line 16 Any thoughts? (I have replaced the true paths given with $IP for security reasons.) --Ds093 23:19, 10 February 2010 (UTC)
 * For the notice: set display_errors to off. For the warning: looks like the 2 extensions send headers, maybe try to comment the lines starting with "header(" in ratingbar.php (line 109, 110, 151 and 152). Patheticcockroach 06:34, 14 April 2010 (UTC)

Integrating into an infobox
Can anyone provide info on how to put this into an infobox like on Wiki4Games? I can't find the infobox to do it. thx
 * Well, just check the corresponding template there: http://www.wiki4games.com/Template:Reviews_users Patheticcockroach 06:34, 14 April 2010 (UTC)

If You Aren't Seeing Table Borders...
In my opinion this should be part of the documentation, but in any case I'd like to save some people some of the time and frustration that I spent trying to figure this out: When you output a rating table, you may notice that the table has no border or background color, even though you see them in the examples here and on other sites where this extension is in use. This is because ratingbar.php makes a css class call to "wikitable" when constructing output tables, but this class DOES NOT EXIST in the default MediaWiki install (pre 1.16 at least). You will need to add the wikitable class to MediaWiki:Common.css, either by Googling it and getting the markup or writing it yourself. Anyway, awesome extension guys. My personal favorite!

Special Page?
Does the special page creation even work?

On my server-hosted wiki there is no Ratings special page, and when I run the wiki virtually on my PC I get an "undefined variable" error of the kind that the guy described above. Under the virtual host, in order for my pages to load properly without the error I have to go into RatingBar.php and Config.php and comment out all the lines that reference the special page. Which is fine, but again, does this function even work anyway? I don't see this special page on any of the wikis that are running the extension - including w4g!
 * It used to work, but it got broken by the first MediaWiki major update that this extension had to face. You can fix it if you want, but since it doesn't really bring anything compared to the tables you can get with the w4g_ratinglist tag I don't think it's worth the trouble. Patheticcockroach 13:52, 29 May 2010 (UTC)

Great extension!
This extension is really good and the listing helps make the main page dynamic. however, brush aside the difficulty of installation, it would be great if we can display more than 1 rating bar in a page and allow anonymous users to rate. --Dullmau 10:20, 14 June 2010 (UTC)
 * It's possible to allow anonymous users: just set $unique_check to 'ip'. As for the several rating bar per page, this was planned in the original design but with all this AJAX and JavaScript stuff I didn't manage to do it :/ Patheticcockroach 20:11, 14 June 2010 (UTC)


 * Thanks. I will try it. Hope that i can install the extension soon! --Dullmau 14:59, 18 June 2010 (UTC)

You need to enable Javascript to vote
Hi, a few days after last attempt, i still don't figure out the problem. As mentioned above by other users, i also had a problem at displaying the rating bar. It shows at preview, but when the page is saved, it only shows the message "You need to enable Javascript to vote".

Here is the error log from Firebug: if ( /^MediaWiki(\/.+)?$/.test( wgPageName ) && wgAction == 'view' ) {
 * 1) Break on error. wgPagename is not defined.

query2page(base_query_url+"?act=load\x26pid="+pid,"w4g_rb_area",2)
 * 1) query2page is not defined

loadbox("rating_target");
 * 1) Break on error.

updatebox("rating_target", user_rating);
 * 1) Break on error.

Do you have any hints? --Dullmau 14:59, 18 June 2010 (UTC)
 * Probably a problem with $path_to_w4g_rb, see http://bbs.wiki4games.com/showthread.php?tid=52 Patheticcockroach 15:37, 18 June 2010 (UTC)


 * Thanks for your efforts. I've spent a few days on figuring out how to use this extension and i'm getting convinced that it won't work on my site... Many issues and bugs keep showing one after one. From SQL error, javascript error and now the common "you must log in or register to vote" error, i can always fix one of them, and then another one will appear. it's really disappointing that I can't use this extension. Patheticcockroach, please don't stop developing this extension. Among all rating extensions, your extension is the only one that offers sorting function and it's of great value to the community. I'll try again tomorrow and see if it will finally work in my website. Anyway, your help over the past few days is greatly appreciated! --Dullmau 19:23, 18 June 2010 (UTC)
 * We'll try to rewrite it this summer. Clearly it's too much bugged to try and patch it everywhere, and since we're spending quite a lot of time helping out users, it might actually save time in the long run to fix it properly... But we'll probably drop some functions in the process, like the mixed logged-in and not logged-in votes, the ability to give any id to a rating bar (even one which isn't a page), and the star-style voting. Of course all of this would be much easier if we could find a decent MediaWiki API documentation. Can't RTFM, without FM! ^^ Patheticcockroach 21:58, 18 June 2010 (UTC)


 * Would it be more convenient to extend and modify Extension:CommunityVoice? Among all rating extensions, this one is used in wikimedia and in my limited experience, it's very stable. Demo --Dullmau 10:09, 19 June 2010 (UTC)
 * Well, I don't know but RatingBar was created before CommunityVoice so we couldn't really base our extension on it ^^ However from the look of it, CommunityVoice doesn't deal with categories the way I'd want it. It also has dependencies, which is something I don't really like in an extension. Finally, now that the clean rewrite is well on its way, it's much easier to continue on it than to extend someone else's extension. Patheticcockroach 05:53, 22 July 2010 (UTC)

On all pages
Hi, I haven't downloaded this extension yet but wanted to know if there is a procedure to add it to the bottom of all article automatically. 67.59.193.62 01:34, 22 July 2010 (UTC)
 * Hi, there isn't such a procedure yet, and there won't be in this version. We're currently working on a complete rewrite which should eventually allow this... when we've found out how to do it (the main reason why development is slow is the lack of documentation) and when the rest of the work is done (the top lists and the special page). Patheticcockroach 05:53, 22 July 2010 (UTC)
 * OK, this function is implemented in the latest development version of W4G Rating Bar. Will publish an updated preview this week-end. (edit: forgot to log in :/) Patheticcockroach 10:11, 23 July 2010 (UTC)
 * Cool stuff 67.59.193.62 23:00, 23 July 2010 (UTC)

MySQL error
Hi, this is my error message:

Warning: mysql_connect [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /hermes/web06/b1995/moo.teachapediaorg/extensions/RatingBar/config.php on line 74 Failed to connected to the database

I followed the directions in running a MySQL query for mwiki_rating bar and it appears to be fine when I check on it in MySQL. I edited config.php per the directions-- except that $ratingbar_dbname is in the config.php where I think $site_name used to be? I also attempted to fix the problem by editing $path_to_w4g_rb	to have the correct path....

This is the section of config.php that seems to have the error and I have no idea what to change. Please help!

// Connect to the database. No need to change this. $ratingbar_tablename = '$table_prefix.$ratingbar_tablename'; $user_tablename = '$table_prefix.$user_tablename'; $categorylinks_tablename = '$table_prefix.$categorylinks_tablename'; $rating_conn= mysql_connect($ratingbar_dbhost, $ratingbar_dbuser, $ratingbar_dbpass) or die("Failed to connected to the database");

I am connecting through a remote host if that matters....
 * Hi, I suggest you install the new version. Although it's not released yet, it's tons easier to setup (the only catch is that you must not forget to replace wik_ with your own database table prefix in db_creation.sql when you run the query in phpMyAdmin) and most likely the database scheme is final. The main con is that it won't have a star design. Patheticcockroach 21:24, 27 July 2010 (UTC)

Thanks for responding! I am trying the new version, but am getting an error message Warning: Missing argument 2 for W4GrbMagic in /hermes/web06/b1995/moo.teachapediaorg/extensions/RatingBarFix/w4g_rb.php on line 116 Which I think is referring to this section of the code: $parser->setHook( 'w4grb_ratinglist', 'W4GrbShowRatingList' ); return true; I did notice that there is no definition of 'w4grb_ratinglist' elsewhere-- I don't know if that matters. I did change the db prefix. I also changed the path at the beginning of the php as I put it in a sub-directory. Other than that, I didn't make any changes...
 * Hm... We're developping it on MW 1.16 beta 3, I guess maybe some things are different in MW 1.15. Try replacing this line 116:  by:  . I'll add this in the next snapshot. Patheticcockroach 22:38, 27 July 2010 (UTC)
 * Wow, I checked out your site and saw you are running MW 1.6! This extension definitely isn't compatible with this version... Why didn't you upgrade to a more recent MW? Your server seems able to run the latest MW version. Patheticcockroach 05:39, 28 July 2010 (UTC)