r45584 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45583‎ | r45584 | r45585 >
Date:21:11, 8 January 2009
Author:ashley
Status:deferred
Tags:
Comment:
show a link to Special:LookupUser on Special:Contributions if the user has 'lookupuser' privilege
Modified paths:
  • /trunk/extensions/LookupUser/LookupUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LookupUser/LookupUser.php
@@ -4,7 +4,7 @@
55 *
66 * @file
77 * @ingroup Extensions
8 - * @version 1.0
 8+ * @version 1.1
99 * @author Tim Starling
1010 * @copyright © 2006 Tim Starling
1111 * @licence GNU General Public Licence
@@ -18,7 +18,7 @@
1919 // Extension credits that will show up on Special:Version
2020 $wgExtensionCredits['specialpage'][] = array(
2121 'name' => 'Lookup User',
22 - 'version' => '1.0',
 22+ 'version' => '1.1',
2323 'author' => 'Tim Starling',
2424 'description' => 'Retrieve information about a user such as email address and ID',
2525 'url' => 'http://www.mediawiki.org/wiki/Extension:LookupUser',
@@ -35,4 +35,24 @@
3636 $wgSpecialPageGroups['LookupUser'] = 'users';
3737
3838 // New user right, required to use the special page
39 -$wgAvailableRights[] = 'lookupuser';
\ No newline at end of file
 39+$wgAvailableRights[] = 'lookupuser';
 40+
 41+// Hooked function
 42+$wgHooks['ContributionsToolLinks'][] = 'efLoadLookupUserLink';
 43+
 44+/**
 45+ * Add a link to Special:LookupUser from Special:Contributions/USERNAME
 46+ * if the user has 'lookupuser' permission
 47+ * @return true
 48+ */
 49+function efLoadLookupUserLink( $id, $nt, &$links ){
 50+ global $wgUser;
 51+ if( $wgUser->isAllowed( 'lookupuser' ) ) {
 52+ wfLoadExtensionMessages( 'LookupUser' );
 53+ $links[] = $wgUser->getSkin()->makeKnownLinkObj(
 54+ SpecialPage::getTitleFor( 'LookupUser' ),
 55+ wfMsgHtml( 'lookupuser' ),
 56+ '&target=' . urlencode( $nt->getText() ) );
 57+ }
 58+ return true;
 59+}
\ No newline at end of file

Status & tagging log