Zsaigol has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/79041


Change subject: Special:ListUsers - add option to filter by blocked status.
......................................................................

Special:ListUsers - add option to filter by blocked status.

Change-Id: I194977dfc899d76c0ca141d89f32dcd4e1c033f6
---
M includes/specials/SpecialListusers.php
M languages/messages/MessagesEn.php
2 files changed, 36 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/41/79041/1

diff --git a/includes/specials/SpecialListusers.php 
b/includes/specials/SpecialListusers.php
index 75b8490..aab92ef 100644
--- a/includes/specials/SpecialListusers.php
+++ b/includes/specials/SpecialListusers.php
@@ -80,6 +80,12 @@
                        }
                }
 
+        $this->showBlocked = 1; // Show all blocked users by default
+        $reqBlockedValue = $request->getInt( 'showBlocked' );
+        if ( $reqBlockedValue > 0 && $reqBlockedValue < 5 ) {
+            $this->showBlocked = $reqBlockedValue;
+        }
+
                parent::__construct();
        }
 
@@ -120,6 +126,20 @@
                if ( $this->editsOnly ) {
                        $conds[] = 'user_editcount > 0';
                }
+
+        if ( $this->showBlocked == 2 ) {
+            // Hide permanently blocked
+            $conds[] = 'ipb_expiry IS NULL OR ipb_expiry != \'infinity\'';
+        } else if ( $this->showBlocked == 3 ) {
+            // Hide temporarily blocked
+            $conds[] = 'ipb_expiry IS NULL OR ipb_expiry = \'infinity\' OR 
ipb_expiry < ' .
+                          $dbr->addQuotes( $dbr->timestamp( wfTimestampNow() ) 
);
+        } else if ( $this->showBlocked == 4 ) {
+            // Hide all blocked
+            $conds[] = 'ipb_expiry IS NULL OR ipb_expiry < ' .
+                            $dbr->addQuotes( $dbr->timestamp( wfTimestampNow() 
) );
+        }
+        // else -> show all users
 
                $options['GROUP BY'] = $this->creationSort ? 'user_id' : 
'user_name';
 
@@ -277,7 +297,17 @@
                        'creationSort',
                        $this->creationSort
                );
-               $out .= '<br />';
+
+        # Show blocked users drop-down list
+        $out .= "<p>\n";
+        $out .= Xml::label( $this->msg( 'listusers-showblocks' )->text(), 
'showBlocked' ) . ' ' .
+            Xml::openElement( 'select', array( 'name' => 'showBlocked', 'id' 
=> 'showBlocked' ) ) .
+            Xml::option( $this->msg( 'listusers-list-all' )->text(), '1', 
$this->showBlocked == 1 ) .
+            Xml::option( $this->msg( 'listusers-perm-block' )->text(), '2', 
$this->showBlocked == 2 ) .
+            Xml::option( $this->msg( 'listusers-temp-block' )->text(), '3', 
$this->showBlocked == 3 ) .
+            Xml::option( $this->msg( 'listusers-all-block' )->text(), '4', 
$this->showBlocked == 4 ) .
+            Xml::closeElement( 'select' );
+               $out .= '</p>';
 
                wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) 
);
 
diff --git a/languages/messages/MessagesEn.php 
b/languages/messages/MessagesEn.php
index 67fe889..d1bde67 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -2781,6 +2781,11 @@
 'listusers-summary'               => '', # do not translate or duplicate this 
message to other languages
 'listusers-editsonly'             => 'Show only users with edits',
 'listusers-creationsort'          => 'Sort by creation date',
+'listusers-showblocks'            => 'Show blocked users:',
+'listusers-list-all'              => 'Yes',
+'listusers-perm-block'            => 'Hide permanently blocked',
+'listusers-temp-block'            => 'Hide temporarily blocked',
+'listusers-all-block'             => 'Hide all blocked',
 'usereditcount'                   => '$1 {{PLURAL:$1|edit|edits}}',
 'usercreated'                     => '{{GENDER:$3|Created}} on $1 at $2',
 'newpages'                        => 'New pages',

-- 
To view, visit https://gerrit.wikimedia.org/r/79041
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I194977dfc899d76c0ca141d89f32dcd4e1c033f6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Zsaigol <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to