From 341552f6618be866571de5e0f1a6c78038bb856a Mon Sep 17 00:00:00 2001 From: umherirrender Date: Wed, 8 Aug 2012 16:25:40 +0200 Subject: [PATCH] Show a "(blocked)" hint on Special:ListUsers/ActiveUsers In ActiveUsers many of the code was there, but there was a mistake in the query. Allowing now also listing hidden active users for users with the 'hideuser' right. Change-Id: I2a4db8433cb5a2dec497c0fa662459cb56df3c3c --- includes/specials/SpecialActiveusers.php | 14 +++++++++----- includes/specials/SpecialListusers.php | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index c5aa23893d..994365edd3 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -93,7 +93,9 @@ class ActiveUsersPager extends UsersPager { function getQueryInfo() { $dbr = wfGetDB( DB_SLAVE ); $conds = array( 'rc_user > 0' ); // Users - no anons - $conds[] = 'ipb_deleted IS NULL'; // don't show hidden names + if( !$this->getUser()->isAllowed( 'hideuser' ) ) { + $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; // don't show hidden names + } $conds[] = 'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ); $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $this->RCMaxAge*24*3600 ) ); @@ -107,7 +109,7 @@ class ActiveUsersPager extends UsersPager { 'rc_user_text', // for Pager 'user_id', 'recentedits' => 'COUNT(*)', - 'blocked' => 'MAX(ipb_user)' + 'ipb_deleted' => 'MAX(ipb_deleted)' ), 'options' => array( 'GROUP BY' => array( 'rc_user_text', 'user_id' ), @@ -117,8 +119,7 @@ class ActiveUsersPager extends UsersPager { 'user' => array( 'INNER JOIN', 'rc_user_text=user_name' ), 'ipblocks' => array( 'LEFT JOIN', array( 'user_id=ipb_user', - 'ipb_auto' => 0, - 'ipb_deleted' => 1 + 'ipb_auto' => 0 )), ), 'conds' => $conds @@ -162,9 +163,12 @@ class ActiveUsersPager extends UsersPager { $groups = $lang->commaList( $list ); $item = $lang->specialList( $ulinks, $groups ); + if( $row->ipb_deleted ) { + $item = "$item"; + } $count = $this->msg( 'activeusers-count' )->numParams( $row->recentedits ) ->params( $userName )->numParams( $this->RCMaxAge )->escaped(); - $blocked = $row->blocked ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : ''; + $blocked = !is_null( $row->ipb_deleted ) ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : ''; return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" ); } diff --git a/includes/specials/SpecialListusers.php b/includes/specials/SpecialListusers.php index 331a0e007b..11d7f4de2b 100644 --- a/includes/specials/SpecialListusers.php +++ b/includes/specials/SpecialListusers.php @@ -89,7 +89,7 @@ class UsersPager extends AlphabeticPager { $conds = array(); // Don't show hidden names if( !$this->getUser()->isAllowed( 'hideuser' ) ) { - $conds[] = 'ipb_deleted IS NULL'; + $conds[] = 'ipb_deleted IS NULL OR ipb_deleted = 0'; } $options = array(); @@ -129,7 +129,6 @@ class UsersPager extends AlphabeticPager { 'user_groups' => array( 'LEFT JOIN', 'user_id=ug_user' ), 'ipblocks' => array( 'LEFT JOIN', array( 'user_id=ipb_user', - 'ipb_deleted' => 1, 'ipb_auto' => 0 )), ), @@ -185,9 +184,10 @@ class UsersPager extends AlphabeticPager { $created = $this->msg( 'usercreated', $d, $t, $row->user_name )->escaped(); $created = ' ' . $this->msg( 'parentheses' )->rawParams( $created )->escaped(); } + $blocked = !is_null( $row->ipb_deleted ) ? ' ' . $this->msg( 'listusers-blocked', $userName )->escaped() : ''; wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) ); - return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}" ); + return Html::rawElement( 'li', array(), "{$item}{$edits}{$created}{$blocked}" ); } function doBatchLookups() { -- 2.20.1