Add edits-only filter to ListUsers (bug 10815)
authorAaron Schulz <aaron@users.mediawiki.org>
Sat, 6 Sep 2008 23:35:24 +0000 (23:35 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Sat, 6 Sep 2008 23:35:24 +0000 (23:35 +0000)
includes/specials/SpecialListusers.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 4a76c0c..7b65adb 100644 (file)
@@ -52,6 +52,7 @@ class UsersPager extends AlphabeticPager {
                if ( in_array( $this->requestedGroup, $symsForAll ) ) {
                        $this->requestedGroup = '';
                }
+               $this->editsOnly = $wgRequest->getBool( 'editsOnly' );
 
                $this->requestedUser = '';
                if ( $un != '' ) {
@@ -70,9 +71,9 @@ class UsersPager extends AlphabeticPager {
 
        function getQueryInfo() {
                $dbr = wfGetDB( DB_SLAVE );
-               $conds=array();
-               // don't show hidden names
-               $conds[]='ipb_deleted IS NULL OR ipb_deleted = 0';
+               $conds = array();
+               // Don't show hidden names
+               $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0';
                if ($this->requestedGroup != "") {
                        $conds['ug_group'] = $this->requestedGroup;
                        $useIndex = '';
@@ -82,6 +83,9 @@ class UsersPager extends AlphabeticPager {
                if ($this->requestedUser != "") {
                        $conds[] = 'user_name >= ' . $dbr->addQuotes( $this->requestedUser );
                }
+               if( $this->editsOnly ) {
+                       $conds[] = 'user_editcount > 0';
+               }
 
                list ($user,$user_groups,$ipblocks) = $dbr->tableNamesN('user','user_groups','ipblocks');
 
@@ -121,13 +125,11 @@ class UsersPager extends AlphabeticPager {
        }
 
        function getBody() {
-               if (!$this->mQueryDone) {
+               if( !$this->mQueryDone ) {
                        $this->doQuery();
                }
-               $batch = new LinkBatch;
-
                $this->mResult->rewind();
-
+               $batch = new LinkBatch;
                while ( $row = $this->mResult->fetchObject() ) {
                        $batch->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
                }
@@ -156,7 +158,9 @@ class UsersPager extends AlphabeticPager {
                        Xml::option( wfMsg( 'group-all' ), '' );
                foreach( $this->getAllGroups() as $group => $groupText )
                        $out .= Xml::option( $groupText, $group, $group == $this->requestedGroup );
-               $out .= Xml::closeElement( 'select' ) . ' ';
+               $out .= Xml::closeElement( 'select' ) . '<br/>';
+               $out .= Xml::checkLabel( wfMsg('listusers-editsonly'), 'editsOnly', 'editsOnly', $this->editsOnly );
+               $out .= '&nbsp;';
 
                wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
 
index 11f74de..f24fded 100644 (file)
@@ -2025,6 +2025,7 @@ Each row contains links to the first and second redirect, as well as the target
 'protectedtitlesempty'            => 'No titles are currently protected with these parameters.',
 'listusers'                       => 'User list',
 'listusers-summary'               => '', # do not translate or duplicate this message to other languages
+'listusers-editsonly'             => 'Show users with edits only',
 'newpages'                        => 'New pages',
 'newpages-summary'                => '', # do not translate or duplicate this message to other languages
 'newpages-username'               => 'Username:',
index d9f4bac..8da58a4 100644 (file)
@@ -1299,6 +1299,7 @@ $wgMessageStructure = array(
                'protectedtitlesempty',
                'listusers',
                'listusers-summary',
+               'listusers-editsonly',
                'newpages',
                'newpages-summary',
                'newpages-username',