Jump to content

Topic on Project:Support desk

Geohei (talkcontribs)

Hi.

Many posts but no real solution found so far.

1. Can I create a username which is completely lowercase? The first letter is always converted to uppercase.

2. Next ... can I rename a username "Abc" into "abc"?

Many thanks,

88.130.92.8 (talkcontribs)

1. No, you cannot. You would have to modify the code in includes/User.php, newFromName() and the functions, which it calls. This code currently changes the first letter to uppercase. Although I do not know the exact reason for that, I well see that the other checks, which are performed to see, if a user is valid/usable/creatable, for a certain reason all do make sense. So I do not expect anything different here.

2. See 1. Maybe you actually can rename the username inside the database, table "user", but a) is going around the API that way not supported and b) would I expect funny errors to happen afterwards.

Geohei (talkcontribs)

Thanks a lot for the answer. The reason I'd like to change this is purely "cosmetic". If I have to face potential DB corruption or weird behavior of WIKI later on, I won't touch it. However I do not see the reason why this case changes of usernames (and also of WIKI page titles) were implemented at a first place.

88.130.80.241 (talkcontribs)

Sorry, I don't know either, but page titles actually really seem to be the main thing to look at: Also when a user is created, it is not only checked, if the username matches the conventions, but also, if the page can be created (which e.g. disallows usernames containing things like "../" as browsers would then no longer be able to open the user page).

If you are interested in that topic, you can read the sourcecode in includes/Titles.php. Maybe it contains a comment on why the first letter is uppercased.

Geohei (talkcontribs)

Yes, will do so. Thanks for the hint!

Bawolff (talkcontribs)

The relavent code to look at is actually in Namespace.php:

        /**
         * These namespaces should always be first-letter capitalized, now and
         * forevermore. Historically, they could've probably been lowercased too,
         * but some things are just too ingrained now. :)
         */
        private static $alwaysCapitalizedNamespaces = array( NS_SPECIAL, NS_USER, NS_MEDIAWIKI );

Other namespaces can be lowercased via $wgCapitalLinks. You can make the first letter of the username lowercase on the title of the userpage (only) via {{DISPLAYTITLE:...}}. Similarly you can use an alternative signature with a lowercase first letter. But at the end of the day, MediaWiki wants the first letter of usernames to start with a capital.

MarkAHershberger (talkcontribs)
Reply to "Username lowercase"