MyBB Community Forums

Full Version: How to force usernames to UPPERCASE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(2018-11-28, 03:51 PM)lisa Wrote: [ -> ]There's a problem Houston!!!  The registration form does show uppercase when you enter it, but the username still gets put in lowercase when it goes into the database...

So it looks like this change ONLY effects what you see, not reality... I'm looking for a new solution.....

CREATE TRIGGER forceupper BEFORE INSERT ON mybb_users FOR EACH ROW SET NEW.username = UPPER(NEW.username);

Problem solved!!
Even if the user enters a username with lowercase letters, the mysql trigger will change it to uppercase.  Exactly what I want.

CREATE TRIGGER forceupper BEFORE INSERT ON mybb_users FOR EACH ROW SET NEW.username = UPPER(NEW.username);

it worked!
(2018-11-29, 01:15 PM)DonaldVaccaro Wrote: [ -> ]
(2018-11-28, 03:51 PM)lisa Wrote: [ -> ]So it looks like this change ONLY effects what you see, not reality... I'm looking for a new solution.....

CREATE TRIGGER forceupper BEFORE INSERT ON mybb_users FOR EACH ROW SET NEW.username = UPPER(NEW.username);

Problem solved!!
Even if the user enters a username with lowercase letters, the mysql trigger will change it to uppercase.  Exactly what I want.

CREATE TRIGGER forceupper BEFORE INSERT ON mybb_users FOR EACH ROW SET NEW.username = UPPER(NEW.username);

it worked!

(2018-11-28, 05:30 PM)laie_techie Wrote: [ -> ]WHY must your usernames be uppercase in the database? Is it for integration with another system (eg. Mediawiki requires wiki-case)? The MyBB login code is case-insensitive.

Why not create a plugin which uses the datahandler_user_insert and datahandler_user_update hooks? You may want to see which other hooks are available in the UserDataHandler class ( inc/datahandlers/user.php).
We are an Amateur radio group and use call signs for usernames. They look stupid in lower case.
I added a field for "Name" to go along with it to make reading posts easier.
Awesome
Pages: 1 2