Jump to the post that solved this thread.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 7 Months, 3 Weeks ago [How To?] How to force usernames to UPPERCASE
#11
Solved: 7 Months, 3 Weeks ago
(11-28-2018, 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!
Reply
#12
Solved: 7 Months, 3 Weeks ago
(11-29-2018, 01:15 PM)DonaldVaccaro Wrote:
(11-28-2018, 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!

(11-28-2018, 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).
Reply
#13
Solved: 7 Months, 3 Weeks ago
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.
Reply
#14
Solved: 7 Months, 3 Weeks ago
Awesome
Hey man, what's up?
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)