Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force lowercase usernames at registration level
Author Message
euantor
Designer/Themer

Support

Posts: 587
Joined: Jun 2009
Reputation: 3
Post: #1
Force lowercase usernames at registration level
There was a question posed on MyBBCentral about how you would go about forcing users to have lowercase usernames. I had a quick look at the core files and found a way of doing it that I thought I would share in case anybody else wanted it.

First of all, we're going to need to edit the member.php core file. Open it up in your favorite editor (I recommend notepad++ for a plain text eitor or Aptana Studio as an IDE).

Find:
PHP Code:
        "username" => $mybb->input['username'], 

Replace with:
PHP Code:
        "username" => strtolower($mybb->input['username']), 

This edit will change all registered usernames to be lowercase after the registration form has been submitted.

I have tested this a fair bit locally in both 1.4.13 and 1.6 BETA so all should be fine

06-03-2010, 05:28 AM
laeresh
Member


Posts: 166
Joined: Sep 2009
Reputation: 3
Post: #2
RE: Force lowercase usernames at registration level
So it chances to lowercase letter, even if they submitted something like DaSpamBot,(-> daspambot).
Without any message or something ?, unless you add a text line yourself.

Venise my site.

Is god willing to prevent evil but not able?
Then he is not omnipotent
Is god able to prevent evil but not willing?
Then he is malevolent
Is god both able and willing to prevent evil?
Then when will it end?
Is god neither able NOR willing to prevent evil?
Then why call him god?

"Americans are stupid because they think they know everything. I know this because I, in fact, know everything" - Anomanderus
06-03-2010, 05:25 PM
euantor
Designer/Themer

Support

Posts: 587
Joined: Jun 2009
Reputation: 3
Post: #3
RE: Force lowercase usernames at registration level
Yup. That's basically what it does You could probably add some kind of notification using an if statement (like if $new = $old { } else { print "your name has been changed"; }; )

06-03-2010, 07:00 PM
laeresh
Member


Posts: 166
Joined: Sep 2009
Reputation: 3
Post: #4
RE: Force lowercase usernames at registration level
I don't think i'd be using this, but if i would i would add a text line above the username bar notifying that uppercase will be set to lowercase.

Once again thanks for this great share which is pure simplicity to use !.

Venise my site.

Is god willing to prevent evil but not able?
Then he is not omnipotent
Is god able to prevent evil but not willing?
Then he is malevolent
Is god both able and willing to prevent evil?
Then when will it end?
Is god neither able NOR willing to prevent evil?
Then why call him god?

"Americans are stupid because they think they know everything. I know this because I, in fact, know everything" - Anomanderus
06-03-2010, 08:13 PM
ProneLegacy
Junior Member


Posts: 21
Joined: Jun 2010
Reputation: 0
Post: #5
RE: Force lowercase usernames at registration level
I am thinking about this for my forum, But I am not sure weather it will cause people to leave :S
06-07-2010, 12:05 AM
ms365
MybbSource Skinner


Posts: 91
Joined: Dec 2009
Reputation: 0
Post: #6
RE: Force lowercase usernames at registration level
Yah some usernames are really Messy(Not that Argentina One ).Is there something which will forbid users to enter symbols and special chars?

"A pessimist sees difficulties in every opportunity; an optimist sees opportunities in every difficulty"
-Winston Churchill
(This post was last modified: 06-08-2010, 05:02 AM by ms365)
06-08-2010, 04:57 AM
euantor
Designer/Themer

Support

Posts: 587
Joined: Jun 2009
Reputation: 3
Post: #7
RE: Force lowercase usernames at registration level
I'm sure there would be a way by preg_replacing the symbols and special chars, but I can't really think of one atm. I'll have a play with it.

06-08-2010, 05:30 AM
groovybluedog
Member


Posts: 131
Joined: Feb 2010
Reputation: 0
Post: #8
RE: Force lowercase usernames at registration level
Is there a code to make all caps changed? Like username hElLo would not be banned but HELLO would?
08-09-2010, 10:30 AM
Don+
Junior Member


Posts: 47
Joined: Aug 2010
Reputation: 0
Post: #9
RE: Force lowercase usernames at registration level
very good guide.
08-21-2010, 10:11 AM
 




User(s) browsing this thread: 2 Guest(s)