Show contribs link only if it applies
authorAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Oct 2008 20:55:35 +0000 (20:55 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Wed, 8 Oct 2008 20:55:35 +0000 (20:55 +0000)
includes/specials/SpecialBlockip.php

index 402ffe6..e449b6e 100644 (file)
@@ -479,13 +479,25 @@ class IPBlockForm {
        private function getConvenienceLinks() {
                global $wgUser;
                $skin = $wgUser->getSkin();
-               $contribsPage = SpecialPage::getTitleFor( 'Contributions', $this->BlockAddress );
-               $links[] = $skin->link( $contribsPage, wfMsgHtml( 'ipb-blocklist-contribs', $this->BlockAddress ) );
+               if( $this->BlockAddress )
+                       $links[] = $this->getContribsLink( $skin );
                $links[] = $this->getUnblockLink( $skin );
                $links[] = $this->getBlockListLink( $skin );
                $links[] = $skin->makeLink ( 'MediaWiki:Ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) );
                return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
        }
+       
+       /**
+        * Build a convenient link to a user or IP's contribs
+        * form
+        *
+        * @param $skin Skin to use
+        * @return string
+        */
+       private function getContribsLink( $skin ) {
+               $contribsPage = SpecialPage::getTitleFor( 'Contributions', $this->BlockAddress );
+               return $skin->link( $contribsPage, wfMsgHtml( 'ipb-blocklist-contribs', $this->BlockAddress ) );
+       }
 
        /**
         * Build a convenient link to unblock the given username or IP