From b63884351fbe183302b68369a208baa1ea4b8aa9 Mon Sep 17 00:00:00 2001 From: Tobias Date: Mon, 7 Sep 2009 01:29:50 +0000 Subject: [PATCH] Display note on Special:Contributions if user is blocked, and provide an excerpt from the block log --- RELEASE-NOTES | 2 ++ includes/specials/SpecialContributions.php | 32 ++++++++++++++++++++++ languages/messages/MessagesEn.php | 1 + 3 files changed, 35 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 69fe3a527d..e51332d3db 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -208,6 +208,8 @@ this. Was used when mwEmbed was going to be an extension. database connection and query errors. * (bug 19646) New hook: ImgAuthBeforeStream for tests and functionality before file is streamed to user, but only when using img_auth * Show change block / unblock link on Special:Contributions if user is blocked +* Display note on Special:Contributions if the user is blocked, and provide an + excerpt from the block log. === Bug fixes in 1.16 === diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index ce621a33db..c78c337a8f 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -223,6 +223,7 @@ class SpecialContributions extends SpecialPage { wfRunHooks( 'ContributionsToolLinks', array( $id, $nt, &$tools ) ); $links = $wgLang->pipeList( $tools ); + $this->showBlock( $nt ); } // Old message 'contribsub' had one parameter, but that doesn't work for @@ -236,6 +237,37 @@ class SpecialContributions extends SpecialPage { } } + /** + * Show a note if the user is blocked and display the last block log entry. + * @param Title $nt Title object for the target + */ + protected function showBlock( $nt ) { + global $wgUser, $wgOut; + $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut ); + $pager = new LogPager( $loglist, 'block', false, $nt->getPrefixedText() ); + // Check if there is something in the block log. + // If this is not the case, either the user is not blocked, + // or the account has been hidden via hideuser. + if( $pager->getNumRows() > 0 ) { + $pager->mLimit = 1; # Show only latest log entry. + $wgOut->addHTML( '
' ); + $wgOut->addWikiMsg( 'sp-contributions-blocked-notice' ); + $wgOut->addHTML( + $loglist->beginLogEventsList() . + $pager->getBody() . + $loglist->endLogEventsList() + ); + if( $pager->getNumRows() > $pager->mLimit ) { + $wgOut->addHTML( $wgUser->getSkin()->link( + SpecialPage::getTitleFor( 'Log', 'block' ), + wfMsgHtml( 'log-fulllog' ), + array(), + array( 'page' => $nt->getPrefixedText() ) + ) ); + } + $wgOut->addHTML( '
' ); + } + } /** * Generates the namespace selector form with hidden attributes. * @param $this->opts Array: the options to be included. diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 84a763aa06..c5b8daff97 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2839,6 +2839,7 @@ $1', 'sp-contributions-logs' => 'logs', 'sp-contributions-talk' => 'talk', 'sp-contributions-userrights' => 'user rights management', +'sp-contributions-blocked-notice'=> 'This user is currently blocked. The latest block log entry is provided below for reference:', 'sp-contributions-search' => 'Search for contributions', 'sp-contributions-username' => 'IP Address or username:', 'sp-contributions-submit' => 'Search', -- 2.20.1