From af0cab16d8de1b2d692325ca4d532d28d68402ee Mon Sep 17 00:00:00 2001 From: Jacob Block Date: Thu, 12 Jul 2012 15:29:10 +0100 Subject: [PATCH] (bug 38362) Special:Listuser now includeable This patch makes Special:Listuser includeable by inserting the following wikitext: {{special:Listusers}} It supports all of [[Special:ListUsers]] short parameters. To list users members of the 'sysop' group use the following wikitext: {{Special:ListUsers/sysop}} Change-Id: Ia0efbfbd6300db5ad67840667c1cb12ab5e003c3 --- CREDITS | 1 + RELEASE-NOTES-1.20 | 1 + includes/specials/SpecialListusers.php | 24 ++++++++++++++---------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CREDITS b/CREDITS index fd86da8fcd..aa55af9afa 100644 --- a/CREDITS +++ b/CREDITS @@ -118,6 +118,7 @@ following names for their contribution to the product. * Grunny * Harry Burt * Ireas +* Jacob Block * Jaska Zedlik * Jeremy Baron * Jidanni diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 29341a6bd6..3b0c9cfdb4 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -101,6 +101,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. the new deletelogentry permission is required for this. * (bug 14237) Allow PAGESINCATEGORY to distinguish between 'all', 'pages', 'files' and 'subcats' +* (bug 38362) Make Special:Listuser includeable on wiki pages. === Bug fixes in 1.20 === * (bug 30245) Use the correct way to construct a log page title. diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index ebcca7313e..923a18dc9c 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -38,7 +38,7 @@ class UsersPager extends AlphabeticPager { * @param $context IContextSource * @param $par null|array */ - function __construct( IContextSource $context = null, $par = null ) { + function __construct( IContextSource $context = null, $par = null, $including = null ) { if ( $context ) { $this->setContext( $context ); } @@ -62,6 +62,7 @@ class UsersPager extends AlphabeticPager { } $this->editsOnly = $request->getBool( 'editsOnly' ); $this->creationSort = $request->getBool( 'creationSort' ); + $this->including = $including; $this->requestedUser = ''; if ( $un != '' ) { @@ -151,14 +152,13 @@ class UsersPager extends AlphabeticPager { $lang = $this->getLanguage(); + $groups = ''; $groups_list = self::getGroups( $row->user_id ); - if( count( $groups_list ) > 0 ) { + if( !$this->including && count( $groups_list ) > 0 ) { $list = array(); foreach( $groups_list as $group ) $list[] = self::buildGroupLink( $group, $userName ); $groups = $lang->commaList( $list ); - } else { - $groups = ''; } $item = $lang->specialList( $ulinks, $groups ); @@ -166,16 +166,15 @@ class UsersPager extends AlphabeticPager { $item = "$item"; } + $edits = ''; global $wgEdititis; - if ( $wgEdititis ) { + if ( !$this->including && $wgEdititis ) { $edits = ' [' . $this->msg( 'usereditcount' )->numParams( $row->edits )->escaped() . ']'; - } else { - $edits = ''; } $created = ''; # Some rows may be NULL - if( $row->creation ) { + if( !$this->including && $row->creation ) { $user = $this->getUser(); $d = $lang->userDate( $row->creation, $user ); $t = $lang->userTime( $row->creation, $user ); @@ -302,6 +301,7 @@ class SpecialListUsers extends SpecialPage { */ public function __construct() { parent::__construct( 'Listusers' ); + $this->mIncludable = true; } /** @@ -313,12 +313,16 @@ class SpecialListUsers extends SpecialPage { $this->setHeaders(); $this->outputHeader(); - $up = new UsersPager( $this->getContext(), $par ); + $up = new UsersPager( $this->getContext(), $par, $this->including() ); # getBody() first to check, if empty $usersbody = $up->getBody(); - $s = $up->getPageHeader(); + $s = ''; + if ( !$this->including() ) { + $s = $up->getPageHeader(); + } + if( $usersbody ) { $s .= $up->getNavigationBar(); $s .= Html::rawElement( 'ul', array(), $usersbody ); -- 2.20.1