Jolten
03-16-2005, 10:00 PM
What's this do?
If you're like me you hate users who register with names like USERNAME. What this mini-hack does is transform all uppercase usernames upon registration to lowercase with an uppercase first letter. This "borrows" a function from the posting functions, therefore if you've got "prevent shouting" applied for posts it will also effect usernames. Preventing shouting in usernames. It will still allow all lowercase names or mixed case names to register properly.
Time to intall: less than 5 minutes
Queries: 0
Files to edit:1
Templates to edit: 0
Open register.php
find:
// convert any whitespace to a single space to prevent users entering 'user one' to look like 'user one'
$_POST['username'] = trim(preg_replace('#\s+#si', ' ', $_POST['username']));
BELOW it add:
// prevent username shouting
function fetch_no_shouting_text($text)
{
// stops $text being all UPPER CASE
global $vboptions;
return iif($vboptions['stopshouting'] AND $text == strtoupper($text), ucwords(vbstrtolower($text)), $text);
}
$_POST['username'] = fetch_no_shouting_text($_POST['username']);
Save
upload
Your done!
This does not effect users already registered. It only prevents new registrations form shouting usernames.
There shouldn't be any support needed, but if there is, I'll handle it exclusively in this thread.
Version history
-------------------------------
v1.00 //initial release
v1.1 // updated to only prevent all uppercase usernames.
If you're like me you hate users who register with names like USERNAME. What this mini-hack does is transform all uppercase usernames upon registration to lowercase with an uppercase first letter. This "borrows" a function from the posting functions, therefore if you've got "prevent shouting" applied for posts it will also effect usernames. Preventing shouting in usernames. It will still allow all lowercase names or mixed case names to register properly.
Time to intall: less than 5 minutes
Queries: 0
Files to edit:1
Templates to edit: 0
Open register.php
find:
// convert any whitespace to a single space to prevent users entering 'user one' to look like 'user one'
$_POST['username'] = trim(preg_replace('#\s+#si', ' ', $_POST['username']));
BELOW it add:
// prevent username shouting
function fetch_no_shouting_text($text)
{
// stops $text being all UPPER CASE
global $vboptions;
return iif($vboptions['stopshouting'] AND $text == strtoupper($text), ucwords(vbstrtolower($text)), $text);
}
$_POST['username'] = fetch_no_shouting_text($_POST['username']);
Save
upload
Your done!
This does not effect users already registered. It only prevents new registrations form shouting usernames.
There shouldn't be any support needed, but if there is, I'll handle it exclusively in this thread.
Version history
-------------------------------
v1.00 //initial release
v1.1 // updated to only prevent all uppercase usernames.