From 80da6cb3f3dee40aaaa0e37562444464c4843481 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 8 Oct 2008 20:55:35 +0000 Subject: [PATCH] Show contribs link only if it applies --- includes/specials/SpecialBlockip.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index 402ffe608d..e449b6e3bb 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -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 ''; } + + /** + * 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 -- 2.20.1