r66543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66542‎ | r66543 | r66544 >
Date:17:48, 16 May 2010
Author:siebrand
Status:ok
Tags:
Comment:
Add a contributions tool link.
Modified paths:
  • /trunk/extensions/Renameuser/Renameuser.i18n.php (modified) (history)
  • /trunk/extensions/Renameuser/Renameuser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/Renameuser.i18n.php
@@ -9,6 +9,8 @@
1010
1111 $messages['en'] = array(
1212 'renameuser' => 'Rename user',
 13+ 'renameuser-linkoncontribs' => 'rename user',
 14+ 'renameuser-linkoncontribs-text' => 'Rename this user',
1315 'renameuser-desc' => 'Adds a [[Special:Renameuser|special page]] to rename a user (need \'\'renameuser\'\' right)',
1416 'renameuser-summary' => '', # do not translate or duplicate this message to other languages
1517 'renameuserold' => 'Current username:',
@@ -53,6 +55,8 @@
5456 * @author Siebrand
5557 */
5658 $messages['qqq'] = array(
 59+ 'renameuser-linkoncontribs' => 'Link description used on Special:Contributions and Special:DeletedContributions. Only added if a user has rights to rename users.',
 60+ 'renameuser-linkoncontribs-text' => 'Tooltip for {{msg-mw|renameuser-linkoncontribs}}.',
5761 'renameuser-desc' => 'Short description of the Renameuser extension, shown on [[Special:Version]]. Do not translate or change links.',
5862 'renameuserreserve' => 'Option to block the old username (after it has been renamed) from being used again.',
5963 'renameuserwarnings' => '{{Identical|Warning}}',
Index: trunk/extensions/Renameuser/Renameuser.php
@@ -62,6 +62,7 @@
6363 $wgJobClasses['renameUser'] = 'RenameUserJob';
6464
6565 $wgHooks['ShowMissingArticle'][] = 'wfRenameUserShowLog';
 66+$wgHooks['ContributionsToolLinks'][] = 'wfRenameuserOnContribsLink';
6667
6768 function wfRenameUserShowLog( $article ) {
6869 global $wgOut;
@@ -74,3 +75,18 @@
7576 }
7677 return true;
7778 }
 79+
 80+function wfRenameuserOnContribsLink( $id, $nt, &$tools ) {
 81+ global $wgUser;
 82+
 83+ if ( $wgUser->isAllowed( 'renameuser' ) ) {
 84+ $sk = $wgUser->getSkin();
 85+ $tools[] = $sk->link(
 86+ SpecialPage::getTitleFor( 'Renameuser' ),
 87+ wfMsg( 'renameuser-linkoncontribs' ),
 88+ array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ),
 89+ array( 'oldusername' => $nt->getText() )
 90+ );
 91+ }
 92+ return true;
 93+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r66544Stylize.php, update indentation, remove trailing whitespace....siebrand18:00, 16 May 2010

Status & tagging log