vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   Prevent shouting in usernames. (https://vborg.vbsupport.ru/showthread.php?t=78272)

Jolten 03-16-2005 10:00 PM

Prevent shouting in usernames.
 
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:
PHP Code:

// 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:
PHP Code:

// 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.

sabret00the 03-17-2005 06:02 PM

you don't need the ucwords function and the strtolower, ucwords should if i read correctly convert all but the first letter to lower, or make all but the first letter to lower.

also by installing this hack you make sure that every username starts with an Upper and the rest are Lower, that could be annoying for a user like me who has his whole username lower by choice.

what would be nice is if you could check if it was shouting then only convert the shouted usernames to lowercase.

oh well bar that, nice addition, it's always nice to see something new being released. :)

Jolten 03-17-2005 06:13 PM

ucwords will not convert characters internally to lowercase so usernames would still appear as UsERnaMe. Therefor the strtolower is necessary.

I realize some users prefer an all lowercase username. That may be an addition to this hack. But right now, this prevents most odd case usernames.

Jolten 03-17-2005 07:03 PM

Okay.. I've updated the hack. It will now only prevent all uppercase names if you have your vbOptions set to prevent shouting.

sabret00the 03-18-2005 07:57 AM

Quote:

Originally Posted by Jolten
ucwords will not convert characters internally to lowercase so usernames would still appear as UsERnaMe. Therefor the strtolower is necessary.

I realize some users prefer an all lowercase username. That may be an addition to this hack. But right now, this prevents most odd case usernames.

my bad :(

good luck with it :)

Jolten 03-18-2005 11:43 PM

gee. I guess no one wanted this at all :)

ResaleBroker 03-20-2005 05:25 PM

That seemed to work great. Thank You!

007 04-22-2005 04:07 AM

Installed! Thanks!

PIKenPIK 04-22-2005 05:10 PM

Thanks ... gettin' a Hangover from those members :tired:

** Clicks Install **

Jenta 05-12-2005 11:38 PM

you know what i would like
make them go back and edit it...return an error

make them mend their riduculous names themselves
jeez i cant stand people that shout with their names
i even have it in big bold letters...do not use all caps!
but they still do

heh, found it
https://vborg.vbsupport.ru/showthrea...=495219#495219 :up:


All times are GMT. The time now is 08:23 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01028 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete