Microchip08 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/213484

Change subject: allow the new username to be populated by subpage
......................................................................

allow the new username to be populated by subpage

Previously, [[Special:RenameUser/Foo]] prefilled the form with "Foo"
as the old username. This commit adds similar functionality for the
new username, so that [[Special:RenameUser/Foo/Bar]] will prefill
the form so that "Foo" is renamed to "Bar".

Change-Id: Ib0cd8b21339276f4f0e7f5d49d22401cce2dcd8f
---
M specials/SpecialRenameuser.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Renameuser 
refs/changes/84/213484/1

diff --git a/specials/SpecialRenameuser.php b/specials/SpecialRenameuser.php
index c8b2a53..8fb7467 100644
--- a/specials/SpecialRenameuser.php
+++ b/specials/SpecialRenameuser.php
@@ -40,10 +40,12 @@
 
                $request = $this->getRequest();
                $showBlockLog = $request->getBool( 'submit-showBlockLog' );
-               $oldnamePar = trim( str_replace( '_', ' ', $request->getText( 
'oldusername', $par ) ) );
+               $usernames = explode( '/', $par, 2 ); // this works as "/" is 
not valid in usernames
+               $oldnamePar = trim( str_replace( '_', ' ', $request->getText( 
'oldusername', $usernames[0] ) ) );
                $oldusername = Title::makeTitle( NS_USER, $oldnamePar );
+               $newnamePar = trim( str_replace( '_', ' ', $request->getText( 
'newusername', $usernames[1] ) ) );
                // Force uppercase of newusername, otherwise wikis with 
wgCapitalLinks=false can create lc usernames
-               $newusername = Title::makeTitleSafe( NS_USER, 
$wgContLang->ucfirst( $request->getText( 'newusername' ) ) );
+               $newusername = Title::makeTitleSafe( NS_USER, 
$wgContLang->ucfirst( $request->getText( 'newusername', $usernames[1] ) ) );
                $oun = is_object( $oldusername ) ? $oldusername->getText() : '';
                $nun = is_object( $newusername ) ? $newusername->getText() : '';
                $token = $user->getEditToken();

-- 
To view, visit https://gerrit.wikimedia.org/r/213484
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0cd8b21339276f4f0e7f5d49d22401cce2dcd8f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Renameuser
Gerrit-Branch: master
Gerrit-Owner: Microchip08 <doug...@chippy.ch>

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

Reply via email to