Extension talk:Contribution Scores/LQT Archive 1

Reset Users Scores
Is there anyway to reset the contribution scores?

1.12.0
I upgraded my wiki to 1.12.0, and noticed that after the update, all contribution scores (score / pages / edits) show the same number. In 1.11.1 it showed an individual number for each field, now they're all the same.
 * Are you using version 1.7.1 of the extension? I just tested on the SVN trunk (1.13alpha) and it's working fine.  Tim Laqua talk 17:06, 26 March 2008 (UTC)
 * This works fine for me with 1.12.0. Thanks :) Patheticcockroach 08:17, 11 April 2008 (UTC)

Doesn't work on MW 1.8.4
I have installed this on 1.8.4 and get an empty SpecialPages page. Does anyone know why this is?
 * It's only been tested down to MW 1.9.3 and only intended for use above 1.10.0 - Not sure what changed from 1.8.4-1.9.3.

(fixed) This extension does not work on portgresql database.
The exception : A database error has occurred Query: SELECT user_id, user_name, COUNT(DISTINCT rev_page) AS page_count, COUNT(rev_id) AS rev_count, (COUNT(DISTINCT rev_page)+SQRT(COUNT(rev_id)-COUNT(DISTINCT rev_page))*2) AS wikiRank FROM mwuser userTable JOIN revision revTable ON (userTable.user_id=revTable.rev_user) WHERE rev_timestamp > '20070815000000' AND user_id NOT IN (SELECT ug_user FROM user_groups WHERE ug_group='bot') GROUP BY user_id, user_name ORDER BY wikiRank DESC LIMIT 50 Function: Error: 1 ERROR: invalid input syntax for type timestamp with time zone: "20070815000000"

Backtrace:


 * 1) 0 /var/www/html/wiki/includes/Database.php(761): DatabasePostgres->reportQueryError('ERROR: invalid...', 1, 'SELECT user_id,...', '', false)
 * 2) 1 /var/www/html/wiki/extensions/ContributionScores/ContributionScores_body.php(46): Database->query('SELECT user_id,...')
 * 3) 2 /var/www/html/wiki/extensions/ContributionScores/ContributionScores_body.php(98): ContributionScores->genContributionScoreTable(NULL, NULL, 7, 50)
 * 4) 3 /var/www/html/wiki/includes/SpecialPage.php(433): ContributionScores->execute(NULL)
 * 5) 4 /var/www/html/wiki/includes/Wiki.php(196): SpecialPage::executePath(Object(Title))
 * 6) 5 /var/www/html/wiki/includes/Wiki.php(45): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
 * 7) 6 /var/www/html/wiki/index.php(89): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
 * 8) 7 {main}
 * Lookin' in to it. I'll switch from literal to use dbr->timestamp for compatibility.
 * Fixed in r25071.
 * Thank you for your support but now i have a new error :
 * But at the end of the error i have the stats

Notice: Undefined variable: sql in /var/www/html/wiki/extensions/ContributionScores/ContributionScores_body.php on line 97 Notice: Undefined property: stdClass::$wikiRank in /var/www/html/wiki/extensions/ContributionScores/ContributionScores_body.php on line 57
 * Fixed $sql/line 97 error in r25086 - do you still get the line 57 error for wikiRank? I also changed the grouping f/ the SQL statement, maybe Postgres doesn't like the way that I did it the first time...  (btw, thx for helping w/ this)
 * Ok the extension work perfectly with postgres. Thank you for your support

Spanish translation
How can I translate this extension in Spanish?

I was trying to edit ContributionScores.i18n.php, but I can't translate it

'es' => array( 				'contributionscores' => 'Puntuaciones por contribuir',				'contributionscores-info' => 	"Las puntuaciones son calculadas siguiendo:\n".												"*1 punto por cada página única editada\n".												"*Raíz cuadrada de (Ediciones totales efectuadas) - (Páginas totales únicas) x 2\n".												"Las puntuaciones son calculadas de esta manera considerando la diversidad sobre el volumen de edición.".												"Básicamente, esta puntuación mide fundamentalmente las páginas únicas editadas, considerando que un alto ".												"volumen de edición supone que es un artículo de mayor calidad.",				'contributionscores-top' => '(Top $1)',				'contributionscores-days' => 'Últimos $1 días',				'contributionscores-allrevisions' => 'Estadísticas globales'       ),

What's the problem? :(

EmuAGR 17:46, 2 September 2007 (UTC)
 * I would imagine you're testing by changing your User Preferences language - it was using wfMsgForContent (which is based on the site language), I just changed it in r25412 to use wfMsg - it should work as you expect now. Note, I added the above translation to the i18n file.  Thx for the translation.
 * Thanks for everything, but it doesn't work yet. You can see it at www.wikimanga.net/wiki/index.php?title=Especial:ContributionScores EmuAGR 19:45, 2 September 2007 (UTC)
 * Yeah, that doesn't look good at all. ;-)  I switched all the accented spanish characters over to the &*acute; HTML codes and it works great now.  Let me know if you're still having problems w/ the new i18n file - fixed in r25414.
 * My bad. I flipped my editor over to UTF-8.  Works fine now.  ;-)

New Spanish translation
Hi, I've translated a new Spanish version, here you have: /** Spanish (Español) * @author EmuAGR */ $messages['es'] = array(   'contributionscores'                 => 'Puntuaciones por contribuir',    'contributionscores-desc'            => 'Acude a la base de datos del wiki en busca de los usuarios que contribuyen más', 'contributionscores-info' => 'Las puntuaciones se calculan de la siguiente forma: Las puntuaciones calculadas de esta manera dan más importancia a la diversidad que al volumen de edición. Básicamente, esta puntuación mide fundamentalmente las páginas únicas editadas, considerando que un alto volumen de edición supone que es un artículo de mayor calidad.',    'contributionscores-top'             => '(Top $1)',    'contributionscores-days'            => 'Últimos $1 días',    'contributionscores-allrevisions'    => 'Estadísticas globales',    'contributionscores-score'           => 'Puntuación',    'contributionscores-pages'           => 'Páginas', 'contributionscores-changes'        => 'Cambios', 'contributionscores-username'       => 'Nombre de usuario', 'contributionscores-invalidusername' => 'Nombre de usuario no válido', 'contributionscores-invalidmetric'  => 'Métrica no válida', );
 * Un (1) punto por cada página única editada
 * Raíz cuadrada de (Ediciones totales efectuadas) - (Páginas totales únicas) x 2

--EmuAGR 12:52, 23 November 2008 (UTC)

Excellent Extension
I installed this on my 1.9 wiki and it worked like a charm! Great job! --Vaccano 21:37, 24 October 2007 (UTC)


 * Same for me on MediaWiki 1.17. Thanks for the great job. --Pintman 09:53, 18 August 2011 (UTC)

Inclusion
If is that possible to be include in a template or something like that?. It could remplace de edicount extension. Or make a fusion of the two.--Add 18:28, 17 December 2007 (UTC)
 * Implemented the ability to include the page in r28646. See main article for instructions.  I believe editcount is a parser function extension - it doesn't have much in common with this extension.
 * Nice feature. I put it on betawiki:User:Siebrand. Would it be possible to strip the talk/contribs/block links from this somehow? In the way I am using it (and they way I assume more will use it, it is taking up more space that I would like to). Cheers! Siebrand 11:28, 19 December 2007 (UTC)
 * Sure. I'm also trying to optimize that query so it doesn't take 14 seconds to load the Special Page.  ;-)
 * notools and nosort options implemented in r28669. See main article for usage.  I also tried to optimize the SQL query - I got an 84% speed increase on a 32000 revision wiki.  I'm interested to see what it does to the 7.716 second load time on Betawiki f/ the Special Page.  Tim Laqua talk 15:51, 19 December 2007 (UTC)

Tested 1.11.1
Works on the latest, 1.11.1. Very easy to set up. Thanks a bunch, this was exactly what we were looking for. Link at http://www.arcandio.com/wiki/index.php5?title=Special:ContributionScores
 * Note - example link above is now dead. Wiki appears to no longer exist. Tim Laqua talk 15:12, 27 March 2008 (UTC)

Possible Enhancement?
I echo the sentiments above. Easy to set up and provides useful data. Thanks. We have only recently set up our wiki and wish to gauge its use. Whilst user contributions are very useful we also wish to establish the total number of views per user in a summary report such as this. None of the other available extensions seem to provide quite what is needed. Would it be possible to add a column with this information? --Phil 09:50, 3 April 2008 (UTC)
 * No, per-user view activity isn't recorded anywhere. You could take the total number of views and get an 'average' - but you couldn't determine 'who' had more views.  An extension could be created to maintain that data.  Feel free to post it in Extension Requests. Tim Laqua talk 02:27, 4 April 2008 (UTC)

ignore blocked users
There's an option  to ignore bots, but is it possible to ignore blocked users? I want to have Contribution Scores table with only active users. gr Jerone 09:36, 17 April 2008 (UTC)
 * Implemented in v1.9, r33496. Use $wgContribScoreIgnoreBlockedUsers = true; Tim Laqua talk 17:37, 17 April 2008 (UTC)
 * Thank you ||Jerone 20:49, 17 April 2008 (UTC)

User Score as Variable?
Could you tell how to make the score of a user a Variable for Extension:Variables? I want to crete a user template the gives out the score of a user or at last the number of edits. Thanks! --Subfader 20:18, 14 May 2008 (UTC)
 * Hmm... I have write a static function to give you that info - So you want it to throw the score of the currently logged in user? Or you want like a parser function?  A parser function would allow you to display the score for a given user (which I assume is what you would want to do on a user page template). Tim Laqua talk 22:00, 14 May 2008 (UTC)
 * Yep as parser function would be ace for the user on whose page the parser is included (via template), not the logged in user (he can check his on his user page :). Would be good to make 3 parser funcs score, changes, pages. Btw: If this parser works I won't need Extension:EditCount which has Inconsistances in the total edit# compared to yours (which I simply assume is the correct one). --Subfader 09:00, 15 May 2008 (UTC)
 * k, I'll try to find some time over the weekend to throw those together. Tim Laqua talk 10:40, 15 May 2008 (UTC)
 * Biggup! ;) --Subfader
 * Implemented in r34903, v1.10 - all #cscore metrics are based on *all* revisions. I also added in $wgContribScoreDisableCache so you can have the metrics display realtime.  Just set it to true Tim Laqua talk 02:03, 16 May 2008 (UTC)
 * Awesome! Smooth like a baby. Thanks for the fast coding :) --Subfader 07:19, 16 May 2008 (UTC)

--207.96.208.130 21:28, 21 August 2008 (UTC) In a template, expression   does not work, when in fact  == 63. Getting: Expression error: Unrecognised punctuation character "�". This is also true if i pass the result via  Any ideas?... Thanks for the help!
 * Guess it's the first | in #cscore:Username|score which is used in #expr? Try replacing the | with | so it's while Template:! in your wiki should read |. --Subfader 16:01, 23 August 2008 (UTC)
 * Thanks for the reply, unfortunatly I'm still getting the same result. Both and  return: Expression error: Unrecognised punctuation character "�". Let me know if you see anything else, thanks! --207.96.208.130 17:07, 25 August 2008 (UTC)


 * SOLUTION, replace

return $parser->insertStripItem($output, $parser->mStripState);
 * by

return $output;
 * please advise if you see anything wrong with doing this. thx --207.96.208.130 21:10, 3 June 2009 (UTC)

Examples
You can add my site as example if you like.
 * Inclusion/Transclusion with disabled $title in _body.php
 * #cscore Parser Function used as "user stats" --Subfader 09:44, 16 May 2008 (UTC)

Edits vs "Changes"
I just noticed that my number of total changes is higher than the number of total edits on Special:Preferences. What causes it? Does edits exclude actions "changes" considers? Will take it off Special:Preferences anyway. --Subfader 15:25, 21 May 2008 (UTC)
 * Well - "edits" is from user.user_editcount - it's a counter that get incremented every time a user edits a page. "changes" is a count of the revisions in the database that belong to a particular user ID.  Which is more accurate?  Dunno.  I'd say "changes" is the real number.  I would imagine there are reasons that user_editcount wouldn't be incremented (I'm not real familiar with when/why that counter gets incremented/decremented).  One is a counter, the other is a result of a query - that's why I never called it an edit count - it's either "revisions" or "changes" from my perspective.  Tim Laqua talk 10:27, 23 May 2008 (UTC)

MySQL 4.0.24 Compability
After installation it keeps showing error "1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT rev_user, COUNT(DISTINCT rev_ (localhost)". I'm using ContributionScores-MW1.12-r31252 with MySQL 4.0.24. Any ideas would be great since I didn't find anything in the MySQL documentation. Cheers, --Till Kraemer 22:22, 2 August 2008 (UTC)

Time Period Enhancement
This is a brilliant extension ( I can't thank you enough ). I'd love the option to have a drop down list of months with the year (ie. Jan 2008, Feb 2008, etc) to pull historical reporting on contribution scores...Is that really easy of much harder then I think? Doug 38.117.240.100 23:34, 7 August 2008 (UTC)


 * OK...I just figured out a way to do it ( sorry for complaining ) but it's so dumb thing with SQL involving this: (PS this involves altering the file ContributionScores_body.php and the code is found around line 49)

if ( $days > 0 && $days < 200601 ) { $date = time - (60*60*24*$days); $dateString = $dbr->timestamp($date); $sqlWhere .= " {$nextPrefix} rev_timestamp > '$dateString'"; $nextPrefix = "AND"; }

if ( $days == 200801 ) { $sqlWhere .= " {$nextPrefix} rev_timestamp"; $sqlWhere .= " BETWEEN '20080101000000' AND '20080131235959'"; $nextPrefix = "AND"; }
 * PREFACE:This is a horrible way to do it (since I don't really know SQL)


 * If the user types in:


 * Instead of getting the intended 200,801 days go, they will get all user contributions between the timestamps of 01/01/2008 00:00:00 to 01/31/2008 11:59:59 (essentially all of Jan 2008).  Why? the SQL statement “BETWEEN '20080101000000' AND '20080131235959'” will only look for activity during that time period...I'm in the process of making it so the extension will throw in the correct title of "January 2008" instead of defaulting to the day count of 200,801 (since it will look cooler)...If anyone wants to pick up the ball and do it the right way, be my guest (but I hope this helps out)!—Sanbitter 01:25, 8 August 2008 (UTC)

MW 1.13?
When I try to open a User Page using an apostrophe from whatever page I get this error:

"Fatal error: Call to a member function getID on a non-object in .../extensions/ContributionScores/ContributionScores.php on line 80" which is if ($user->getID != 0) { --Subfader 17:26, 26 August 2008 (UTC)
 * Installed on 1.13 without issue, using the standard installation documentation. CaliVW78 09:16, 29 July 2009 (UTC)

Modification to show most active users this month
In file ContributionScores_body.php, line 182, after this:

if ( is_null( $days ) || $days < 0 ) $days = 7;

Add this:

if ( $days=='m' ) $days = date('j');

In this case, if you call with, m will be replaced with the current day of the month, so you will get a table of most active users this month.

Option To Specify Columns?
This looks like a great extension. I haven't tried it in my own wiki yet, but I've played with it in the sandbox of another wiki that has it. I would like to be able to specify which columns are shown in the output, though, because my users are only interested in the final score, not pages or changes. Could you make options for that?

I thought that if no column options were given, then the display would be as it is now. If options for one or more of the three numeric columns is given, those columns and the name column would be shown. The name column would always be shown. The options could be named,  , and. To get a able of the top 20 scores in a wiki, but not show pages or changes, one could use:

Also, is there a way to specify options without specifying a number of days, the "7" in this example?

--Lance E Sloan 20:18, 6 March 2009 (UTC)

odd class in MW 1.14
I think the .contributionscores.odd {} is broken in MW 1.14. --Subfader 23:07, 26 March 2009 (UTC)

Disable score definition?
I don't think the score definition is fair. E.g. I have 54470 changes on 33365 pages - score: 33656. Is it possible to use a plain average instead? --Subfader 11:44, 4 June 2009 (UTC)
 * Another odd one: 5 changes on 3 pages = score 6 huh? --Subfader 00:31, 9 June 2009 (UTC)

Mediawiki 1.15
Has anyone got this to work on mediawiki 1.15?--Bluesoju 02:32, 3 July 2009 (UTC)
 * Incase anyone else is wondering, it works --Bluesoju 05:25, 14 July 2009 (UTC)

List of "User --- Pages"
Thanks for the great extension. Would it be possible to alter the extension to show a table of: User       Pages edited          Date of last edit - Jonathan   dfjsdflskjf           1/2/08 sdkfljsfljsdfslkj    1/5/09 sdflkjdflsfj         1/1/09 Andrew     sdsdflkjsdfljk        5/4/02 sdflkjsflksjf        5/5/09 (etc) My wiki is quite small so I wouldn't be worried if it involved a lot of SQL queries!

Also, would it be possible to ignore a particular editor (me) who has done nearly all the pages?

Many thanks Jonathan3 18:09, 31 August 2009 (UTC)

Namespace Filtering
This is a nice extension that has motivated my users to contribute. Unfortunately the scores are bloated by image uploads which each count as a page. Could you please add an option to limit or include only certain namespaces, for example Main only, or excluding File namespace. I think this would be an easy addition to the SQL as the field is in the page table.

Wonderful Extension
Really like it a lot. Had a quick look at the mysql database and came up with two potentially useful/interesting additions that could be made rather easily: select count(*) from revision where user_id=x and rev_parent_id=0; Sum_all-revisions-of-user-X( (rev_len(current revision) - rev_len(parent revision) ) In addition I'd think it would be neat if the formula for the Contribution Score could include those values and be changed in either LocalSettings.php or via a Special:ContributionScoreFormula page. Scores really get people hooked and changing the formula helps steer users in the direction you want the wiki to take.
 * Number of new Pages created (while in populating your wiki stage could be boosted in the score calculation)
 * Total number of characters added (pseudo_code)

code changes to add new metric "Pages created"
Had a little programming fun and implemented the new metric Page Creations (for MW 1.13). Only new pages created with a minimum of 256Bytes will count, in order to avoid having Users try to boost their score by creating lots of empty pages. As well file uploads are logged as 0 length new page creations. I'd rather not have those count either.

''Note: I use a different formula than the one that was precoded. I'm not much of a sql wizard. And never used php before. So be weary of this code ;-)''

ContributionScores.php: these changes will add a new metric and change how the score metric is calculated. if ($metric=='score') { $res = $dbr->select('revision',                                                                       'COUNT(DISTINCT rev_page)+(COUNT(rev_id)-COUNT(DISTINCT rev_page))/2 AS wiki_rank',                                                                        array('rev_user' => $user->getID)); $row = $dbr->fetchObject($res); $wiki_rank = $row->wiki_rank; $userid = $user->getID; $res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}"); $row = $dbr->fetchObject($res); $wiki_rank = $wiki_rank + $row->pagecreation_count/2; $output = round($wiki_rank,0); } elseif ($metric=='pagecreations') { $userid = $user->getID; $res = $dbr->query("SELECT COUNT(rev_id) AS pagecreation_count FROM revision WHERE rev_parent_id=0 AND rev_len>256 AND rev_user={$userid}"); $row = $dbr->fetchObject($res); $output = $row->pagecreation_count; }

ContributionScores_body.php: these changes will add new column Pages Created to the Lists: $sqlMostNewPages = "SELECT rev_user,                                                COUNT(DISTINCT rev_page) AS newpage_count                                                 FROM {$revTable}                                                 {$sqlWhere} AND rev_parent_id=0 AND rev_len > 256                                                 GROUP BY rev_user                                                 ORDER BY newpage_count DESC                                                 LIMIT {$limit}"; $sqltmp = "SELECT user_id, ". "user_name, ". "page_count, ". "rev_count ". "FROM $userTable u JOIN (($sqlMostPages) UNION ($sqlMostRevs)) s ON (user_id=rev_user) ". "LIMIT $limit";

$sql = "SELECT res1.user_id, ". "res1.user_name, ". "res1.page_count, ". "res2.newpage_count, ". "res1.rev_count, ". "res1.page_count+(res1.rev_count-res1.page_count)/2 + res2.newpage_count/2 AS wiki_rank ". "FROM ( ($sqltmp) as res1, ($sqlMostNewPages) as res2 ) ". "WHERE res1.user_id=res2.rev_user ORDER BY wiki_rank DESC ". "LIMIT $limit";

$output = " with   (4 times for "pages" and "changes") in ContributionScores.php and ContributionScores_body.php --Subfader 13:15, 26 February 2010 (UTC)
 * replace  with   (2 times for "score")

Correction of table
The cells inside the tr tag should be th's, not td's: $output = " . --Subfader 03:29, 13 June 2011 (UTC)

Unrecognised punctuation character
* NaN changess (should return "change" if user has 1 edit) The output of #cscore cannot be used for further parsing. --Subfader 19:04, 1 July 2011 (UTC)
 * (should return "change" if user has 1 edit)

Does not work with SQLite
When using the extension with the SQLite database backend i get an SQL error.

„1: near "UNION": syntax error“.

Maybe SQLite is not aware of union statements? --Pintman 11:54, 18 August 2011 (UTC)

User Scores by Group
Would it be possible to display scores of certain groups only (say Administrators)? My wiki currently has many different groups and it would be great to be able to display the top scores of each group. Nicholas --64.126.15.20 20:56, 23 August 2011 (UTC)

MW 1.18 / Contribution Scores
There appears to be no errors, however the extension never updates after edits.