MyBB Community Forums

Full Version: Username Case changing.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to capitalize the first letter of my usernames.

Does anyone know how i can do that?

I have even tried renaming each user and it goes back to lower case.

(2011-03-24, 02:48 AM)littleaton Wrote: [ -> ]I would like to capitalize the first letter of my usernames.

Does anyone know how i can do that?

I have even tried renaming each user and it goes back to lower case.

You mean you automatically want the new username who registers to have their first letter capitalize?
Yes that is correct, is this possible without a lot of file editing?

I found the case setting when it pulls it form the db, in the functions files, but would like to know if there is an easy fix, or plugin that can do this.
Here is a plugin which will force new registrants to use upper case letter in usernames. If they enter lower cases then only first letter will automatically upper cased.

[Image: attachment.php?aid=223]
[Image: attachment.php?aid=224]

http://yaldaram.com/showthread.php?tid=358
Rather than trying to change it in the database a simpler solution would be to just change it in $mybb-user['username']
This way wherever the above is called it will have the username capitalized.

NOTE: I have not tested this so please make backups in case there is is any undesirable effect.

Open:
inc/class_session.php around line 138
After:
$mybb->user = $db->fetch_array($query);

Add:
$mybb->user['username'] = ucfirst(strtolower($mybb->user['username']));

If you want to capitalize first letter of each word in case the username is more than one word then it would be:
$mybb->user['username'] = ucwords(strtolower($mybb->user['username']));