Show change block / unblock link on Special:Contributions if user is blocked
authorTobias <churchofemacs@users.mediawiki.org>
Sun, 6 Sep 2009 22:53:04 +0000 (22:53 +0000)
committerTobias <churchofemacs@users.mediawiki.org>
Sun, 6 Sep 2009 22:53:04 +0000 (22:53 +0000)
RELEASE-NOTES
includes/specials/SpecialContributions.php

index c55f7af..69fe3a5 100644 (file)
@@ -207,6 +207,7 @@ this. Was used when mwEmbed was going to be an extension.
 * Added $wgShowDBErrorBacktrace, to allow users to easily gather backtraces for
   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
 
 === Bug fixes in 1.16 ===
 
index 4e9be9b..f6f81d0 100644 (file)
@@ -161,12 +161,30 @@ class SpecialContributions extends SpecialPage {
                        # Talk page link
                        $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
                        if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && IP::isIPAddress( $nt->getText() ) ) ) {
-                               # Block link
-                               if( $wgUser->isAllowed( 'block' ) )
-                                       $tools[] = $sk->linkKnown(
-                                               SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
-                                               wfMsgHtml( 'blocklink' )
-                                       );
+                               if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
+                                       if ( $wgUser->isBlocked() ) {
+                                               $tools[] = $sk->linkKnown( # Change block link
+                                                       SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
+                                                       wfMsgHtml( 'change-blocklink' )
+                                               );
+                                               $tools[] = $sk->linkKnown( # Unblock link
+                                                       SpecialPage::getTitleFor( 'BlockList' ),
+                                                       wfMsgHtml( 'unblocklink' ),
+                                                       array(),
+                                                       array(
+                                                               'action' => 'unblock',
+                                                               'ip' => $nt->getDBkey() 
+                                                       ),
+                                                       array( 'known' )
+                                               );
+                                       }
+                                       else { # User is not blocked
+                                               $tools[] = $sk->linkKnown( # Block link
+                                                       SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
+                                                       wfMsgHtml( 'blocklink' )
+                                               );
+                                       }
+                               }
                                # Block log link
                                $tools[] = $sk->linkKnown(
                                        SpecialPage::getTitleFor( 'Log' ),