Extension talk:W4G Rating Bar

From MediaWiki.org
Jump to: navigation, search


Have Rating column appear first[edit source]

When displaying top lists is there any way to have the rating column display first?

If using WYSIWYG Extension, editing a page with Rating List screws up the code[edit source]

<w4grb_ratinglist toppages category="PS2 Games"/>

If I want to display a list of ratings as above then when using FCKEditor or WYSIWYG Extension and I edit the page, the table code gets screwed up like this:

Pages with the highest average rating in category PS2 Games (showing up to 10 pages)
Page Rating Vote count
Forza 2 67% 1

Your old extension Rating_Bar did not have that problem. At the moment I have to include the code from a template to prevent this problem but that's annoying. Is there any way to fix this problem or is there any way I can use some sort of special tag to prevent the editor from screwing up the code?

Bug in read-only mode[edit source]

Mediawiki 0.16: When in read-only mode, going to a page with a rating bar will print out a whole HTML page of Special:Lockdb screenshot (some content removed)

The <html>...</html> is returned from the AJAX query. I see you have some code in SpecialW4GRB_body.php for handling read-only requests, so presume it works in earlier versions of MW. Possibly an issue with MW AJAX requests in read-only mode?

As a very cheap and incomplete workaround I've replaced w4g_rb.php:617

if(!$wgW4GRB_Settings['ajax-fresh-data']) $output .='


if(!wfReadOnly() && $wgW4GRB_Settings['ajax-fresh-data']) $output .='

Bcoughlan 00:57, 26 December 2010 (UTC)

Nicely spotted, thanks. Fixed in next version. Patheticcockroach 17:29, 26 December 2010 (UTC)

Bug (w/ workaround): rating bar does not show when a page is created[edit source]

If you create a page and put a rating bar in it, it will not show up the first time.

This is caused by: if(!$page_obj->setFullPageName($fullpagename)) { return array(''.wfMsg('w4g_rb-no_page_with_this_name',$fullpagename).'', 'noparse' => true, 'isHTML' => true); }

in function W4GrbShowRatingBar (w4g_rb.php).

Only happens when you put a rating bar in while creating a page, doesn't happen when editing an existing page.


In w4g_rb.php, add a line at the start of function W4GrbShowRatingBar with the text "$parser->disableCache();" Bcoughlan 00:57, 26 December 2010 (UTC)

Yup, the problem with this solution is that it will disable the cache on all pages which use the extension. I guess I could make it an option, though, until I find better... Patheticcockroach 23:03, 23 December 2010 (UTC)
I think the problem has to do with the page not existing when the bar is generated. Perhaps it's possible to disable the cache only if the page doesn't exist? Something like $title = Title::newFromText($parser->getTitle()->mPrefixedText); if (!$title) $parser->disableCache(); (Haven't tested that) Bcoughlan 00:57, 26 December 2010 (UTC)
Thanks again and a lot, I can't believe I didn't think about that and am now in the process of slamming my head against the wall ;) Fixed in the next version too. Patheticcockroach 17:38, 26 December 2010 (UTC)
Hehe, glad to help. It's only an issue for me because I have a bot generating a lot of pages with rating bars in them. Thanks. Bcoughlan 19:18, 26 December 2010 (UTC)

Can not be downloaded~[edit source]

I found the download page "official page"(this page),but I can not download it from that page. I can not unzip it.(.7z)--Xlsoul 04:47, 30 July 2010 (UTC)

The current development builds are packed often and kept as back-ups, so I used a rather common, open source archiver that gave a much better compression (7-Zip). Here's version 1.9-dev-19 as a zip. Patheticcockroach 05:54, 30 July 2010 (UTC)
Thanks a lot!This is my first-time asking for help on talk page.I am not good at English.Actually,I mean that I can download the 7zip document but I can not unzip it normally,like "Unsupported compression method for xxx.js".I think that it's my computer's issues.(My friend download it and unzip it easily).Thank you.In addition,can W4G Rating Bar be used as a star like AjaxRatingScript?That extension can only show one rating in one page and it's mandatory so it's not used for me.Rating Bar can do it.Can W4G do it too?--Xlsoul 11:31, 30 July 2010 (UTC)
Yeah, I guessed it was more of a decompression problem ;). We even used LZMA2 so maybe old 7-Zip versions don't like it (not sure though, as it seems my old IZarc can deal with them). Anyway, the star style is, as mentioned in "Features removed compared to the previous version", not available in this extension. We had to focus on one single style to put everything in place and make sure an unlimited number of bars can work together on a same page. The stars are not scheduled to come back yet. The first priorities are fixing the bugs we might still find, and then improve the current bar layout (I got some ideas but couldn't implement them yet). When all that is done and solidly tested, maybe we'll be introducing back some of the removed features. This choice of simplicity over features was made to reduce code complexity and chances of bugs: no more big features until we're sure we have a very stable version to rely on, which is what we really lacked with the previous Rating Bar 1.1. Patheticcockroach 14:22, 30 July 2010 (UTC)

Fatal error[edit source]

I install 2.0b2 in mediawiki 1.15.4 which is installed in XAMPP 1.7.2(php 5.3.0+apache 2.2+MySql 5.1.37) but got following errors: Fatal error: Call to undefined method OutputPage::getTitle() in D:\xampp\htdocs\mediawiki-1.15.4\extensions\W4GRatingBar\w4g_rb.php on line 143 — Preceding unsigned comment added by (talkcontribs)

Hi, this extension requires MediaWiki 1.16. Yet this error is strange because we didn't get it when testing on MW 1.15.4... But still, try upgrading to 1.16 first :) Patheticcockroach 14:50, 6 August 2010 (UTC)

You can't display more than 1 rating bar(s) on the same page.[edit source]

I had my administrator install the W4G rating bar, but when I try to use it I get the above error. Here is my page: http://www.vtk.org/Wiki/VTK/Sandbox/Ratings - anyone have any idea what is going wrong? Daviddoria 16:41, 2 September 2010 (UTC)

Hi, did he configure $wgW4GRB_Settings['max-bars-per-page'] properly? (default is currently 1, ie limits to 1 bar per page) Patheticcockroach 19:37, 2 September 2010 (UTC)
I'm sure he didn't change anything from the defaults. The default of 1 sounds fine - but it seems to be allowing 0, right? Is there a way for me, as a user, to check the value of that variable? Daviddoria 11:57, 3 September 2010 (UTC)
Actually, I do see a working rating bar on the page you link to. (I misread, I thought you wanted to add one more.) As a user the only way to check that variable is to try to display more than the maximum allowed amount of rating bars. Patheticcockroach 16:14, 3 September 2010 (UTC)
What the heck, it is working now. That is very strange... but great! Sorry for the noise and thanks for the help. Daviddoria 18:55, 3 September 2010 (UTC)

You can't display more than 1 rating bar(s) on the same page (ONLY WHEN LOGGED IN!)[edit source]

There were too many indents above to continue :). When I am not logged in to the wiki, the voting bar is displayed properly. When I am not logged in (anonymously viewing), the bar is not displayed, but rather I see "You can't display more than 1 rating bar(s) on the same page". Thoughts on this? Daviddoria 19:01, 3 September 2010 (UTC)

That's really weird, for me the bar was visible when anonymous but not when logged in (but when logged in I could see it in preview mode). I then purged the page and now I can see it in both cases... Patheticcockroach 06:48, 4 September 2010 (UTC)
Hm, you're right. I added it to another page, it didn't work, I purged, and then it worked. Is this a bug? This could be quite annoying to do for hundreds of pages haha. Daviddoria 13:13, 4 September 2010 (UTC)
Actually, this time I purged and now there is an error "you need to enable java script to vote" http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistanceBetweenPoints - Thoughts? Daviddoria 13:24, 4 September 2010 (UTC)
About the Javascript issue, it's caused by the £%!#!** parser which adds a stupid paragraph within the script tag when the bar is loaded in a div... to fix it simply add a line break in w4g_rg.php on line 633 just after </script> (ie, before the ';). About the bar count, I really don't see what the problem can be, I don't manage to reproduce it on my test installation... I guess the easiest way would be to configure the limit to 2. Patheticcockroach 16:46, 4 September 2010 (UTC)

Sort pages by rank[edit source]

I plan to put these on hundreds of pages - is there a way to "show all pages with a rating bar and sort them in order of their ranking?" Daviddoria 19:01, 3 September 2010 (UTC)

The top list can list all pages with a least a vote, but otherwise there's no way to list pages with the bar on but with no votes. The syntax for this would be like <w4grb_ratinglist toppages items="[a big number]"/> (and you'd need to configure the max number of items, too) Patheticcockroach 07:06, 4 September 2010 (UTC)
Perfect, this is exactly what I wanted. Daviddoria 13:13, 4 September 2010 (UTC)

NC[edit source]

Is it okay to put this extension on a website that will be supported through ads and/or donations? Smile Lee 04:54, 1 October 2010 (UTC)

The license seems actually unclear about that. My original intention was just to apply it to how you use/distribute the code itself or to patent commercial usages, for instance:
  • you can't sell the code or create modified versions of it
  • you can't make a commercial service that revolves essentially around the code
But you can use the extension as is to enrich a MediaWiki site as long as it's free (gratis), even if it contains ads or is funded by non-mandatory donations. Patheticcockroach 09:51, 1 October 2010 (UTC)

Thank you so much for clearing that up. Awesome extension btw.

p.s. I used Wiki4Games for a quick brush-up before I did recent run of Sonic & Knuckles. Smile Lee 10:25, 1 October 2010 (UTC)

No problem, don't hesitate to add yourself to the "who's using it" list ;) Patheticcockroach 07:14, 2 October 2010 (UTC)

Star style rating[edit source]

Hi there.

Why was the star rating style removed? It was what my users want! Now I can't move to this newer version. Which is a real shame as I like the look of the new security. I would have thought Star ratings were far more common that percentages.

Thanks mitchelln 15:41, 8 October 2010 (UTC)

Hi, the star style was removed because it was a real pain to get it working along with the other style (among other things, the crazy MediaWiki parser didn't help - it's indeed the cause of the last big bug of 2.0-rc1, reported a bit higher by Daviddoria). With the tiny development time I had, a choice had to be made, and naturally I chose what I use on Wiki4Games. Of course, this choice has its downsides, but at least now the code is crystal clear (kind of ^^) while the old one was a total mess. Patheticcockroach 10:09, 17 October 2010 (UTC)

Hi, Does anyone else have time to modify the ajax to use stars? I too would rather have stars as well(or any image file at that as then I can swap it out to other images). I would love for someone to take this one. Let me know if anyone has a further update. info@trailwiki.us --Fox15rider 00:49, 7 December 2011 (UTC)

Database prefixes[edit source]

If you integrate the installer for this into update.php (see LiquidThreads and ConfirmAccount for examples), you can put /*$wgDBprefix*/ in the SQL and the updater will handle prefixes automatically. :-) —Emufarmers(T|C) 22:44, 12 February 2011 (UTC)

Ah for some reason I stopped receiving notifications for the talk page... I'll have a look at that, I've always wondered how to include automated database actions into extension but never knew where to start. Patheticcockroach 09:51, 9 March 2011 (UTC)

New core feature: "Article feedback"[edit source]

Article feedback may be the way to go. I'm glad I waited ;) --Subfader 16:25, 21 February 2011 (UTC)

Well, this extension is primarily developed for a video game rating system, not for rating articles. So yeah, if you need to rate articles, that Article feedback thing is probably better for you :) Patheticcockroach 10:07, 9 March 2011 (UTC)

Multiple votes for different items on one page?[edit source]

Hi, Does this extension support voting for different items on the one page?

I know about the max-bars-per-page setting - but I assume that is just displaying the same vote widget multiple times on the one page?

I want something that allows you to set multiple questions for one wiki page. ie A poll which counts votes for different aspects of the page subject.

Can this extenstion do that?

PS if not, can you make it do it as a paid job?


Hi, and sorry for the late reply, the notification got once again lost somewhere on the Internet... or more likely was never sent :s I'm not really sure of what you mean:
  • if you want to rate different aspects of the same page, I suggest you have a look at what Subfader posted above: Article feedback
  • if you want to rate several different pages on the same page, the extension can do it (that's the point of max-bars-per-page)
Patheticcockroach 08:33, 26 March 2011 (UTC)

ND, really?[edit source]

You do not allow people to make improvements to the code?! --Jeroen De Dauw 12:29, 22 March 2011 (UTC)

Hi, I agree that's a bit extreme, but the last time I published a GPL extension it ended up on MW's SVN with the link in the credits removed... Fool me once, shame on you; fool me twice, shame on me (plus I eventually found out MW doesn't really have a clean record on respecting authors' wishes as long as the license doesn't clearly impose them), so I thought now I'll pick a license which does protect attribution properly, with an extra lock. It doesn't prevent you from submitting patches to me, but it prevents them from popping up in forks here and there. SMF-ish ^^ Patheticcockroach 08:33, 26 March 2011 (UTC)
Did you talk to anybody about this? Extensions in SVN should include attribution regardless of what license is being used (and, in general, people should avoid committing extensions without contacting the author).
I'm not sure what your link is supposed to be indicating; maybe I'm missing the backstory. —Emufarmers(T|C) 21:11, 27 March 2011 (UTC)
Well, seeing how all other extensions in SVN seem to have no credit link pointing elsewhere than to MediaWiki, I just assumed this was standard policy to edit links for extensions in SVN... I was told when the extension had been placed in SVN, though, but didn't check the changes immediately. So when I noticed like a year later that the link was gone, I thought it wasn't worth the trouble and that I'd just be more careful with my future license choices.
The link to BOUML was just to give an example of the kind of license drama which I really don't want to have to deal with. I stumbled upon it after the fire (just looking for an UML editor ^^), read a bit about it, and came to just a simple conclusion: if the license allows it, then there's always a possibility that Wikipedia/MediaWiki will do it. Even though I like the GPL, I have to admit that I find it highly unclear on attribution (among other things). If I had more time and money, surely I'd consider reading it several times with some lawyers in order to be able to both use it and protect the work I do, but unfortunately I don't. The CC-BY-NC-ND, on the other hand, is crystal clear... Less time spent on the law, more time spent on the code :) Patheticcockroach 20:23, 28 March 2011 (UTC)
As an aside, the BOUML issue is an issue the author is having with Wikimedia Commons, which is kind of separate from MediaWiki. (MediaWiki is the software, Wikimedia Commons is a website that happens to use the software. Both are supported by the Wikimedia Foundation, and their userbase has a lot of overlap, but at the end of the day they are separate projects). Furthermore, it seems kind of irrelevant to the situation at hand (The commons admins are arguing the logo is ok to keep because its too simple to be copyrighted. That argument applies no matter if the logo is GPL, cc-by-sa-nc-nd, or all rights reserved. Your extension on the other hand is obviously a creative work, so such an argument would not apply). However, with that said you should of course chose whatever license you feel comfortable with. As you say people will use whatever permissions you give them, so you should only give them the permissions you're comfortable with. Note: All extensions on SVN should have attribution. Normally this is done by a comment at the top of the php files, as well as code in $wgExtensionCredits to make it show up on special:version. If someone is committing an extension by someone else, usually they will also mention the author in the commit message. Removing attribution to the respective authors in an extension would be something that is considered extremely serious. Bawolff 21:02, 28 March 2011 (UTC)

Characters in page name create error[edit source]

I am using a template to display a rating bar on certain pages and I am receiving an error on page names that include a symbol (ex: & ' , ").

Example: Oops! No page seems to have this name (Mexico's Drug Industry). If you are just previewing a new or very recently created page, this error message is normal and will disappear once the page is created and propagated to slave databases. The given value was not understood.

--Dgennaro 19:45, 31 March 2011 (UTC)

Hm, are you passing the page name as an argument or are you just letting the extension figure out? Here the special characters don't seem to trouble the extension: http://www.wiki4games.com/Wiki4Games:Sandbox/That%27s_sp%26cial_characters. Patheticcockroach 22:07, 31 March 2011 (UTC)
I have a template displaying the rating bar and using the {{PAGENAME}} magic word.
I appreciate your help. Thanks, --Dgennaro 13:15, 1 April 2011 (UTC)
Any particular reason why you don't just use {{#w4grb_rate:}}? Otherwise, the proper variable would be {{FULLPAGENAME}}, but even that seems to get broken when dealing with special characters... Which is weird because entering the very same string "manually" does work. I don't really know what seems to be the problem :/ Patheticcockroach 13:39, 1 April 2011 (UTC)
Removing the {{PAGENAME}} solved the issue. Thank you for your swift response. --Dgennaro 14:09, 1 April 2011 (UTC)

Help![edit source]

Hi, I am ShermanTheMythran from the Lego Universe Stories Wiki, and am looking to include this extension on the wiki. However, I'm not clear on how to install it. The instructions about "making a folder" for the files don't make much sense to me, even though I am a Bureaucrat. Sorry for the newbie question, but how do I install it, if I can? Thanks in advance! - ShermanTheMythran

You can't do it yourself, ask Wikia staff. Max Semenik 16:26, 4 May 2011 (UTC)
Thanks much! - ShermanTheMythran

Sidebar rating[edit source]

Is it possible to show the bar in the sidebar? How could I do that? --Krusher 13:35, 11 May 2011 (UTC)

Hi, this is not possible at the moment. Actually, I think the bar (101 x 2px + a few more to display the percentage) wouldn't fit in the sidebar. Patheticcockroach 14:05, 11 May 2011 (UTC)

Wrong Link by clicking page names in list[edit source]

how ca i fix the problem that this extension provides links in the summary-lists with "...?title=/wiki/regRed/index.php/Test&action=edit&redlink=1" and not only with "...?title=Test&action=edit&redlink=1" ? At the moment all my Toplinks to pages go wrong because of the wrong Link-Syntax. Is there any solution? — Preceding unsigned comment added by (talkcontribs)

Hm, that's weird: those links are produced using standard functions from the MediaWiki environment, I think... Doesn't this problem occur also in other areas of your wiki? Might be related to badly configured pretty URLs or something. Otherwise, could you provide a link to your wiki? Patheticcockroach 08:14, 24 May 2011 (UTC)
I try it in our Live-Environment and give an answer. -- 08:56, 24 May 2011 (UTC)
everything works fine now. apache restart, maybe there was a problem with the conf. -- 09:43, 24 May 2011 (UTC)

FCK Editor turns dynamic Summary-Lists into fixed tables =[edit source]

A summary-page will become a static table page by open the page with the extension "FCK Editor" WITHOUT changing anything. if i switch back to wiki editor, there are table tags. is there an solution to save the rating URL like <w4grb_ratinglist latestvotes items="5" nosort/> -- 08:56, 24 May 2011 (UTC)

Ow... I guess I'll have to try out that FCK Editor then... the main things I'm wondering is whether or not the same issue will occur with other tag-based extension. Patheticcockroach 09:22, 24 May 2011 (UTC)
It seems so, the extension "ImageMap" produces in FCK also an error and the page is useless after saving. ahhh -- 09:42, 24 May 2011 (UTC)
Most likely a bug with FCK then. From their site they still seem fairly experimental. Notably they say they take great care to replace HTML markup with wiki markup, probably the process isn't very polished yet and tags are expanded and eventually converted into inert tables... Patheticcockroach 10:31, 24 May 2011 (UTC)

Switched skin from Monobook & can't see the rating bar just msg[edit source]

Hello I was dabbling with switching from the default Monobook skin and noticed when I do switch to another skin (erudite) the W4G Rating Bar says " You need to enable JavaScript to vote". The "Current user rating: 74/100 (4 votes)" part shows just not the slider. Would you have any ideas how to get it to work in other skins besides monobook? — Preceding unsigned comment added by (talkcontribs)

Well I'm currently using it with Vector... running it with any skin shouldn't be an issue, I don't know what could be causing the problem. Could you post a link to your wiki? Patheticcockroach 13:09, 17 June 2011 (UTC)
Hello NM - somehow it works fine now! Not sure what I did but works like a charm thank you for such a great extension!

Using this outside of a wiki[edit source]

OK, weird (maybe stupid) question, but humor me:

The story is, I've been working on a website that I've realized is not actually suited for a wiki, and shouldn't run under MediaWiki at all.

However, I love this rating bar, and I've invested a fair amount of time into creating/tweaking images and the Javascript to my particular needs, and I really don't want to throw the baby (Rating Bar) out with the bathwater (MW).

As someone who is close to novice when it comes to PHP, I haven't figured it out yet, but is it even possible to tweak or rewrite the code somehow such that this extension can be decoupled from, and run independently of, MediaWiki?

- Chris

After moving a wiki[edit source]

After moving a wiki to a new server I see this instead of the rating bar:

Oops! No page seems to have this name (Object). If you are just previewing a new or very recently created page, this error message is normal and will disappear once the page is created and propagated to slave databases.

An example of page with rating bar

How to fix it? — Preceding unsigned comment added by Beznogim (talkcontribs)

That's quite weird actually. The only thing that comes to my mind is that maybe when moving to your "new" server you downgraded PHP to an unsupported or buggy version. I see you're running PHP 5.1.6: it reached EOL a while ago, and actually even PHP 5.2.x is unsupported now. I'm not sure about MW 1.16, but MW 1.17 requires PHP 5.2.x. The extension wasn't tested with PHP 5.1.x either. Patheticcockroach 07:14, 30 August 2011 (UTC)
You are right, thanks.

Auto-Include feature[edit source]

Is there a way to use the Auto-Include feature, but don't show it at the Main Page?

Btw, I tried to use an extension to show it on every page, but it shows "You need to enable JavaScript to vote". But when I change the auto-include feature to True, it works.

Any Ideas?

P.S.: I tried add a line break, but didn't work.

load HTML output outside bodyContent[edit source]

The HTML output of W4GRB is loaded on the end of the bodyContent, just before the display of category. I want the HTML to be loaded on another spot. Where is stated that the output should be loaded in bodyContent and how can I change it to another div. For instance into a div with id=whatsinaname Hans2103 12:48, 17 November 2011 (UTC)

Removing The % Sign From The Rating[edit source]

I run a website called TrailWIKI.us and for me having a rating of say 67 is better then 67%. So I removed the % sign from the W4G Rating Bar. There is a couple of places you need to remove this from. Open the following three files in a txt editor. I recommend Notepa++ as it gives you line count and highlighted code. Open SpecialW4GRB_body.php, w4g_rb.php, and w4g_rb.js in Notepad++. One small note before you begin, If you upgrade W4G Rating Bar to a new release you will overwrite these files and have to make the changes again.

On line 210 of SpecialW4GRB_body.php

echo wfMsg('w4g_rb-you_voted').' <b><span id="w4g_rb_rating_value-'.$this->bar_id.'">'.$vote_sent.'</span>%</b>';

Change this line to

echo wfMsg('w4g_rb-you_voted').' <b><span id="w4g_rb_rating_value-'.$this->bar_id.'">'.$vote_sent.'</span></b>';

On line 270 of SpecialW4GRB_body.php

$out .= wfMsg('w4g_rb-you_voted').' <b><span id="w4g_rb_rating_value-'.$this->bar_id.'">'.$existing_vote.'</span>%</b>';

Change this line to

$out .= wfMsg('w4g_rb-you_voted').' <b><span id="w4g_rb_rating_value-'.$this->bar_id.'">'.$existing_vote.'</span></b>';

On line 312 of w4g_rb.php


Change this line to


On line 357 of w4g_rb.php


Change this line to


On line 412 of w4g_rb.php


Change this line to


On line 502 of w4g_rb.php

.($hideavgrating? '' : '<td>'.round($row->avg).'%</td>')

Change this line to

.($hideavgrating? '' : '<td>'.round($row->avg).'</td>')

On line 502 of w4g_rb.php

.($wgW4GRB_Settings['show-voter-names']? '<td>'.round($row->avg).'%</td>' : '')

Change this line to

.($wgW4GRB_Settings['show-voter-names']? '<td>'.round($row->avg).'</td>' : '')

On line 1 of w4g_rb.js at the very end modify


Change this last little part of the code to


Also if you wish for the numbers to be centered in the grey space on the right of the rating bar add a few more non breaking line spaces like the example below.


Move Article will W4G follow?[edit source]

When I move a page to a new page name W4G Rating Bar does not follow. If the page previously had votes I have to go into the database and change the database entry to the new name. Is there a way to do this automatically? --TrailWIKI.us 20:01, 12 January 2012 (UTC)

Oasis skin[edit source]

It seems that the extension can't work with the Oasis skin. Ftiercel (talk) 19:02, 30 April 2012 (UTC)

Is it possible to rate files with it?[edit source]

My Wiki is for students and grants them the chance to upload work they do to support fellow students (like protocolls etc.). Now just because a student thinks he is right, doesn't mean he has to be, which means that the files may contain wrong information. To resolve this issue I thought a rating system might be good. People should rate after taking the test the files they used to prepare for it.

The closed thing to what I had in mind is your extension. Now I wanted to ask, if this is even possible. What I imagine is something like this. I just copied one bar via paint, so I haven't tried this yet. Now I want to ask whether this is even possible. Most pages will contain 3 to 5 files, but some might have 10 to 15. Is that possible?

And just for the eyes: is it possible to make it smaller and put the text part (how much votes) behind the bar?

Thanks, --DMR (talk) 18:53, 15 August 2012 (UTC)

single user rating[edit source]

First at all I want to thank you for this nice extension. For our Wiki, where user can leave a comment at the page, I needed the given rating of that user (to display by template). At the moment there is no ability to display this, by using {{#w4grb_rawrating:[page name]|n}} or something like that.

Your licence wouldn't allow the change of your code. So, this way I'm asking for your allowance ;-) Letofred)

Otherway I suggest the following changes for a newer version:

function W4GrbShowRawRating ( $parser, $fullpagename = '', $type = '' )
global $wgUser;

	$output = '';
	# Get textual page id
	if($fullpagename == '')
		$fullpagename = $parser->getTitle();
	$page_obj=new W4GRBPage();
		return array('<span class="w4g_rb-error">'.wfMsg('w4g_rb-no_page_with_this_name',$fullpagename).'</br></span>', 'noparse' => true, 'isHTML' => true);
	if($type=='avg') $output = $page_obj->getAVG();
	else if ($type=='n') $output = $page_obj->getNVotes();
	else $output = $page_obj->getMyVote(User::idFromName($type));	
	return $output;
	private $vote;	# vote of user

	public function getMyVote($uid)
	$pid = $this->page_id;
		$dbslave = wfGetDB( DB_SLAVE );
		$result = $dbslave->select('w4grb_votes', 'uid,pid,vote',
				array('pid' => $pid, 'uid' => $uid),
		if($row = $dbslave->fetchObject($result))
			$this->vote = wfMsg('w4g_rb-voted').' '.intval($row->vote).'%';
			$this->vote = wfMsg('w4g_rb-you_didnt_vote');
		return $this->vote;
	'w4g_rb-voted' => 'voted',
{{#w4grb_rawrating:[page name]|{{{USER}}} }}
-> within a template the rating of {{{USER}}} is shown.

remark: {{{USER}}} should not equal to 'avg' or 'n' - all other arguments will be a username, if not existing the result will be 0.

Hi, thanks for your comment, I think this is actually the first comment about the ND license which isn't just a codeless rant ;) I obviously don't have the time to maintain the extension anymore, and a license change is long overdue. Feel free to apply those modifications, I'll set the license to just CC-BY-NC-SA. Patheticcockroach (talk) 16:49, 1 November 2012 (UTC)
Thank you! Just respecting your work ;-) --Letofred (talk)

Toplist with worst ratings[edit source]

Is it possible to generate an automatic "Toplist" with the worst Pages? Its easy to create a Toplist with the best pages (best ratings) but i need a list with the worst rated pages. Thanks Gerd :o) -- 15:31, 22 January 2013 (UTC)

Hi, I'm not developing this extension anymore, but maybe you could try the order="asc" option, although I'm not sure it's available for the top list by average rating. Patheticcockroach (talk) 17:32, 22 January 2013 (UTC)

It'n not available for the toplist - damn ... any possible help? -- 13:02, 13 September 2013 (UTC)

Use W4G Rating Bar with IE8[edit source]

Hi, we use this extension. In firefox without any problems but in IE8 appears: Meldung: Objekt erforderlich Zeile: 70 Zeichen: 4 Code: 0 URI: http://MY_URL_AND_PATH/extensions/w4gratingbar/w4g_rb.js

The rating doesn't work in IE8. Is there any help outside ?!? ;o) Thanks a lot.

Maybe is there another rating bar, which is easy to use to rate articles and which provides a toplist?!

Thanks. Gerd

Problem when using rawrating or ratinglist[edit source]

When referring to a rating bar's value using the rawrating command or creating a list with the ratinglist command, the values do not update upon reload of the page. The only way the values will change is if the wiki page itself is edited and saved. Is there any work around to this? We want pages that don't get edited very often to have dynamic values with the rating system.

Is this still an issue? I had thought about using this extension instead of VoteNY, but if the rawrating only updates on edit/save, I'd stick with what I've got. On the other hand, if this was just due to caching, I suppose I wouldn't be too concerned. Joshkking (talk) 05:13, 28 November 2015 (UTC)

Is there any way to "reset" the votes for a page after a page has been improved[edit source]

Im using this rating bar as a way to find and fix the worst pages on my system.

Is there any way that I can reset the votes for a particular page after a page has been reviewed and improved?

Problem after MediaWiki upgrade to 1.23[edit source]

After upgrade, Special Page is not more accesible. The following error appears in logs :

PHP Fatal error:  Call to undefined method W4GRB::includable() in /var/datas/mediawiki/extensions/W4G Rating Bar/SpecialW4GRB_body.php on line 31

In the page, the contructor is the following :

       function __construct()
               parent::__construct( 'W4GRB');
               $this->includable( false );

Function includable does not exist anymore. But the constructor in the parent class is :

    public function __construct(
        $name = , $restriction = , $listed = true,
        $function = false, $file = , $includable = false
    ) {
        $this->mName = $name;
        $this->mRestriction = $restriction;
        $this->mListed = $listed;
        $this->mIncludable = $includable;

So mIncludable is false by default and this is not required to call something like $this->includable( false ); We can just change the constructor as following :

       function __construct()
               parent::__construct( 'W4GRB');
               # $this->includable( false );
I can confirm this behavior and resolution --Joshkking (talk) 04:00, 18 December 2015 (UTC)

You need to enable JavaScript to vote[edit source]

"You need to enable JavaScript to vote" shows instead of ratingbar after anybody edited page. If I change something in "LocalSettings.php" (even comments), ratingbar on this page starts to behave normally. Just to the moment when somebody edits page again. Any clues? Also, it gives three errors:

"Uncaught ReferenceError: W4GRB is not defined

Uncaught ReferenceError: loadbox is not defined

Uncaught ReferenceError: updatebox is not defined".

UPD: "$wgEnableParserCache = false" solves the problem.

I have the same problem. Does anyone know how to fix?
Do we really want our parser cache disabled just for this extension though? It'd be nice to not have to here. Perhaps the extension is getting due for an update with the new mediawiki versions. I've noticed I had some of the same issues of nearby posters as well. --Joshkking (talk) 03:59, 18 December 2015 (UTC)
Edit- Actually disabling the parser cache doesn't work for me, thought interestingly I have the same errors except for the first one. --Joshkking (talk) 04:23, 18 December 2015 (UTC)

mysql_real_escape_string(): Access denied for user @'localhost' (using password: NO) on line 453[edit source]

Workaround for this problem: replace "mysql_real_escape_string" on line 453 for "mysql_escape_string". I don't know how to solve this correctly, but this solution works.

Strict Standards: Only variables should be assigned by reference in /customers/9/f/6/mysite.com/httpd.www/extensions/w4g/SpecialW4GRB_body.php on line 45[edit source]

Hi, for several days I have this problem: Strict Standards: Only variables should be assigned by reference in /customers/9/f/6/mysite.com/httpd.www/extensions/w4g/SpecialW4GRB_body.php on line 45
The issue appeared suddenly, I have not made any changes to my wiki recently for a year and it worked out perfectly ... How can I fix it?

Try this: http://www.jouvinio.net/wiki/index.php/W4G_Rating_Bar

new version[edit source]

I've made a fork on github that I'm working on updating so it works well with 1.27, it can be found here migration might not work, the rest of it should be updated and fully working with the latest version of mediawiki as seen here redekopmark (talk) 13:56, 7 September 2016 (UTC)