Last modified: 2012-08-04 22:26:36 UTC
I have a bunch of user groups with restricted editing access. The groups members needed to be visible so I need to transclude the Special:Listusers page.
Created attachment 10840 [details] Bug38362 Patch Adds transclusion to SpecialListusers. For transclusion it removes groups, # edits, and creation date from the rows.
This is my first patch ever so I hope I'm in line with all the MediaWiki standards. I was also interested in displaying the user_real_name instead of the user_name for each item. You can do that by adding the following to LocalSettings.php. This will also make the default Special:Listusers page display user_real_name also. I don't think there is a way to differentiate from the given hooks. $wgHooks['SpecialListusersQueryInfo'][] = 'getRealName'; $wgHooks['SpecialListusersFormatRow'][] = 'setRealName'; function getRealName( $special, &$query ) { $query['fields'][] = 'user_real_name'; return true; } function setRealName( &$item, $row ) { $userPage = Title::makeTitle( NS_USER, $row->user_name ); $userName = Title::makeTitle( NS_USER, $row->user_real_name ); if ($userName->getText() != '') { $item = Linker::link( $userPage, htmlspecialchars( $userName->getText()) ); } else { $item = Linker::link( $userPage, htmlspecialchars( $userPage->getText()) ); } return true; }
Oh yeah, thanks Reedy for all the help. :)
I've not actually tested it yet... But I have committed it ;) The only minor issue I saw with coding style was trailing whitespace on a couple of lines; very easily fixed! https://gerrit.wikimedia.org/r/#/c/15544
(In reply to comment #4) > https://gerrit.wikimedia.org/r/#/c/15544 ^ There's a couple of comments on there if you want to help address them ;)
Created attachment 10841 [details] Adds transclude SpecialListusers page Adds transclude to SpecialListusers. Fumbled the first patch.
Ah quite embarrassing! Completely fumbled my first patch. There should be !'s to NOT break functionality. Doh! And I don't have access or know how to use gerrit yet so I'm just re-uploading the patch with those changes. For the documentation description you might change it to: * (bug 38362) Added transclude functionality to SpecialListuser. Another way of getting the same functionality without the change to the constructor would be to change the hook wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); to include &$edits and &$created. But one might also want to know in the hook if it's currently being transcluded, in which case you would still want to pass something to the constructor and then to the hook. Thanks, sorry about the fumble!
Gerrit change #15544 is now successfully merged