Index: trunk/extensions/LookupUser/LookupUser.php |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * @version 1.0 |
| 8 | + * @version 1.1 |
9 | 9 | * @author Tim Starling |
10 | 10 | * @copyright © 2006 Tim Starling |
11 | 11 | * @licence GNU General Public Licence |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | // Extension credits that will show up on Special:Version |
20 | 20 | $wgExtensionCredits['specialpage'][] = array( |
21 | 21 | 'name' => 'Lookup User', |
22 | | - 'version' => '1.0', |
| 22 | + 'version' => '1.1', |
23 | 23 | 'author' => 'Tim Starling', |
24 | 24 | 'description' => 'Retrieve information about a user such as email address and ID', |
25 | 25 | 'url' => 'http://www.mediawiki.org/wiki/Extension:LookupUser', |
— | — | @@ -35,4 +35,24 @@ |
36 | 36 | $wgSpecialPageGroups['LookupUser'] = 'users'; |
37 | 37 | |
38 | 38 | // 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 |