(bug 38362) Special:Listuser now includeable
authorJacob Block <Jacob.Block@gmail.com>
Thu, 12 Jul 2012 14:29:10 +0000 (15:29 +0100)
committerAntoine Musso <hashar@free.fr>
Fri, 27 Jul 2012 16:18:31 +0000 (18:18 +0200)
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
RELEASE-NOTES-1.20
includes/specials/SpecialListusers.php

diff --git a/CREDITS b/CREDITS
index fd86da8..aa55af9 100644 (file)
--- 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
index 29341a6..3b0c9cf 100644 (file)
@@ -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.
index ebcca73..923a18d 100644 (file)
@@ -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 = "<span class=\"deleted\">$item</span>";
                }
 
+               $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 );