Display note on Special:Contributions if user is blocked, and provide an excerpt...
authorTobias <churchofemacs@users.mediawiki.org>
Mon, 7 Sep 2009 01:29:50 +0000 (01:29 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Mon, 7 Sep 2009 01:29:50 +0000 (01:29 +0000)
RELEASE-NOTES
includes/specials/SpecialContributions.php
languages/messages/MessagesEn.php

index 69fe3a5..e51332d 100644 (file)
@@ -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 ===
 
index ce621a3..c78c337 100644 (file)
@@ -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( '<div class="mw-warning-with-logexcerpt">' );
+                       $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( '</div>' );
+               }
+       }
        /**
         * Generates the namespace selector form with hidden attributes.
         * @param $this->opts Array: the options to be included.
index 84a763a..c5b8daf 100644 (file)
@@ -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',