r45572 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45571‎ | r45572 | r45573 >
Date:19:05, 8 January 2009
Author:ashley
Status:deferred
Tags:
Comment:
regexBlock: add regexBlock link to Special:Contributions if user has the 'regexblock' permission, just as CheckUser extension currently does
Modified paths:
  • /trunk/extensions/regexBlock/regexBlock.php (modified) (history)
  • /trunk/extensions/regexBlock/regexBlockCore.php (modified) (history)

Diff [purge]

Index: trunk/extensions/regexBlock/regexBlockCore.php
@@ -625,4 +625,22 @@
626626
627627 wfProfileOut( __METHOD__ );
628628 }
 629+
 630+ /**
 631+ * Add a link to Special:RegexBlock from Special:Contributions/USERNAME
 632+ * pages if the user has 'regexblock' permission
 633+ * @return true
 634+ */
 635+ public static function loadContribsLink( $id, $nt, &$links ){
 636+ global $wgUser;
 637+ if( $wgUser->isAllowed( 'regexblock' ) ) {
 638+ wfLoadExtensionMessages( 'RegexBlock' );
 639+ $links[] = $wgUser->getSkin()->makeKnownLinkObj(
 640+ SpecialPage::getTitleFor( 'RegexBlock' ),
 641+ wfMsgHtml( 'regexblock' ),
 642+ '&ip=' . urlencode( $nt->getText() ) );
 643+ }
 644+ return true;
 645+ }
 646+
629647 }
\ No newline at end of file
Index: trunk/extensions/regexBlock/regexBlock.php
@@ -57,7 +57,8 @@
5858 'descriptionmsg' => 'regexblock-desc',
5959 );
6060
61 -// add hook
 61+// Hooked functions
 62+$wgHooks['ContributionsToolLinks'][] = 'RegexBlock::loadContribsLink';
6263 $wgHooks['GetBlockedStatus'][] = 'RegexBlock::check';
6364
6465 // Set up the new special page

Status & tagging log