Page MenuHomePhabricator

Make Special:Listuser includeable on wiki pages
Closed, ResolvedPublic


Author: Jacob.Block

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.

Version: 1.19
Severity: minor



Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:09 AM
bzimport set Reference to bz38362.
bzimport added a subscriber: Unknown Object (MLST).

Jacob.Block wrote:

Bug38362 Patch

Adds transclusion to SpecialListusers. For transclusion it removes groups, # edits, and creation date from the rows.

attachment Bug-38362-Added-transclusion-to-SpecialListusers.patch ignored as obsolete

Jacob.Block wrote:

This is my first patch ever so I hope I'm in line with all the MediaWiki

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;


Jacob.Block wrote:

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!

(In reply to comment #4)

^ There's a couple of comments on there if you want to help address them ;)

Jacob.Block wrote:

Adds transclude SpecialListusers page

Adds transclude to SpecialListusers. Fumbled the first patch.


Jacob.Block wrote:

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 15544 is now successfully merged