r73376 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73375‎ | r73376 | r73377 >
Date:14:29, 20 September 2010
Author:churchofemacs
Status:resolved (Comments)
Tags:
Comment:
don't display renameuserlog on pages of usurped accounts. Thanks to Chzz for this idea
Modified paths:
  • /trunk/extensions/Renameuser/Renameuser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/Renameuser.php
@@ -64,10 +64,15 @@
6565 $wgHooks['ShowMissingArticle'][] = 'wfRenameUserShowLog';
6666 $wgHooks['ContributionsToolLinks'][] = 'wfRenameuserOnContribsLink';
6767
 68+/**
 69+ * Show a log if the user has been renamed and point to the new username.
 70+ * Don't show the log if the $oldUserName exists as a user.
 71+ */
6872 function wfRenameUserShowLog( $article ) {
6973 global $wgOut;
7074 $title = $article->getTitle();
71 - if ( $title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) {
 75+ $oldUserName = User::newFromName( $title->getBaseText() );
 76+ if ( ($title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) && $oldUserName->getId()==0) {
7277 // Get the title for the base userpage
7378 $page = Title::makeTitle( NS_USER, str_replace( ' ', '_', $title->getBaseText() ) )->getPrefixedDBkey();
7479 LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false,

Follow-up revisions

RevisionCommit summaryAuthorDate
r73415fixing r73376: error with IP userpageschurchofemacs21:56, 20 September 2010
r73531cosmetic code changes to r73415 and r73376churchofemacs14:00, 22 September 2010

Comments

#Comment by Raymond (talk | contribs)   20:37, 20 September 2010

Seen on Translatewiki:

PHP Fatal error: Call to a member function getId() on a non-object in /www/w/extensions/Renameuser/Renameuser.php on line 75

#Comment by Church of emacs (talk | contribs)   21:58, 20 September 2010

Thanks Raymond. Hopefully fixed in r73415.

Status & tagging log