Revision: 45572
Author:   ashley
Date:     2009-01-08 19:05:43 +0000 (Thu, 08 Jan 2009)

Log Message:
-----------
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
    trunk/extensions/regexBlock/regexBlockCore.php

Modified: trunk/extensions/regexBlock/regexBlock.php
===================================================================
--- trunk/extensions/regexBlock/regexBlock.php  2009-01-08 18:51:11 UTC (rev 
45571)
+++ trunk/extensions/regexBlock/regexBlock.php  2009-01-08 19:05:43 UTC (rev 
45572)
@@ -57,7 +57,8 @@
        'descriptionmsg' => 'regexblock-desc',
 );
 
-// add hook
+// Hooked functions
+$wgHooks['ContributionsToolLinks'][] = 'RegexBlock::loadContribsLink';
 $wgHooks['GetBlockedStatus'][] = 'RegexBlock::check';
 
 // Set up the new special page

Modified: trunk/extensions/regexBlock/regexBlockCore.php
===================================================================
--- trunk/extensions/regexBlock/regexBlockCore.php      2009-01-08 18:51:11 UTC 
(rev 45571)
+++ trunk/extensions/regexBlock/regexBlockCore.php      2009-01-08 19:05:43 UTC 
(rev 45572)
@@ -625,4 +625,22 @@
 
                wfProfileOut( __METHOD__ );
        }
+
+       /**
+        * Add a link to Special:RegexBlock from Special:Contributions/USERNAME
+        * pages if the user has 'regexblock' permission
+        * @return true
+        */
+       public static function loadContribsLink( $id, $nt, &$links ){
+               global $wgUser;
+               if( $wgUser->isAllowed( 'regexblock' ) ) {
+                       wfLoadExtensionMessages( 'RegexBlock' );
+                       $links[] = $wgUser->getSkin()->makeKnownLinkObj(
+                                               SpecialPage::getTitleFor( 
'RegexBlock' ),
+                                               wfMsgHtml( 'regexblock' ),
+                                               '&ip=' . urlencode( 
$nt->getText() ) );
+               }
+               return true;
+       }
+
 }
\ No newline at end of file



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to