Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 22 Jan 2014, 18:06
d1jsp's Avatar
d1jsp d1jsp is offline
 
Join Date: Aug 2013
Disallow Space in Username

Hello folks,

I have googled this already before coming here, and my research has not been successful. I know how to accomplish this through modifying the code, but I want to minimize modifying vbulletin standard code to keep the files scalable with updates.

I use the Username Regular Expression :
^[A-Z0-9]

Which the help function suggests disallows spaces. However, users are still popping up with spaces in their usernames.
Reply With Quote
  #2  
Old 22 Jan 2014, 18:13
noppid noppid is offline
 
Join Date: Mar 2003
Use a different test. http://php.net/manual/en/function.strpos.php
__________________
Add a photo gallery garage to your auto forum and get noticed by your members. Find out how at the vBulletin Computer Help Forum.
An informed rider makes their first destination the motorcycle forum at rider info.
Reply With Quote
  #3  
Old 22 Jan 2014, 18:19
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by d1jsp View Post
I use the Username Regular Expression :
^[A-Z0-9]
I think the expression should be

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If you leave off the +$ then it's only saying that the name has to start with a letter or number. But you should be aware that if you use that expression, then names can only contain letters or numbers (and no other symbols), so you would need to add any other symbols you want to allow.

Of course, none of this will affect any existing names.

Last edited by kh99; 22 Jan 2014 at 19:01. Reason: clarified part about other symbols
Reply With Quote
  #4  
Old 22 Jan 2014, 18:28
d1jsp's Avatar
d1jsp d1jsp is offline
 
Join Date: Aug 2013
Originally Posted by kh99 View Post
I think the expression should be

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If you leave off the +$ then it's only saying that the name has to start with a letter or number. But if you use the expression I posted, then names can only contain letters or numbers (and no other symbols). Of course, none of this will affect any existing names.
This may be the problem; I will let you know.

I appreciate the response.
Reply With Quote
  #5  
Old 22 Jan 2014, 18:36
noppid noppid is offline
 
Join Date: Mar 2003
You both forgot lower case letters and a few other characters. Just saying.
__________________
Add a photo gallery garage to your auto forum and get noticed by your members. Find out how at the vBulletin Computer Help Forum.
An informed rider makes their first destination the motorcycle forum at rider info.
Reply With Quote
  #6  
Old 22 Jan 2014, 18:47
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by noppid View Post
You both forgot lower case letters and a few other characters. Just saying.
The code where that option is used looks like this:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


The 'i' in the siU at the end means ignore case, so that expression will allow lower case. I did mention that no other characters would be allowed, but I added to that post in case it wasn't clear what I meant.

Last edited by kh99; 22 Jan 2014 at 19:00.
Reply With Quote
  #7  
Old 30 Jan 2014, 04:55
JαρŘασoζ's Avatar
JαρŘασoζ JαρŘασoζ is offline
 
Join Date: Oct 2008
So if I put this code "^[A-Z0-9]+$" to Username Regular Expression in vBulletin Options, that should be worked? So user cannnot make username that has space in it. Am I right?
Reply With Quote
  #8  
Old 30 Jan 2014, 05:35
tbworld tbworld is offline
 
Join Date: Oct 2008
Originally Posted by kh99 View Post
The 'i' in the siU at the end means ignore case, so that expression will allow lower case.
I guess I can shorten my regex then.

Thanks for pointing out that code @Kh99. I had no idea they appended to the regular expression. I learn at least 10 things every day around here.

Last edited by tbworld; 30 Jan 2014 at 09:45.
Reply With Quote
  #9  
Old 30 Jan 2014, 09:19
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Originally Posted by JαρŘασoζ View Post
So if I put this code "^[A-Z0-9]+$" to Username Regular Expression in vBulletin Options, that should be worked? So user cannnot make username that has space in it. Am I right?
Yes. A user should then only be able to create a user name with letters and numbers only.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 12:22.

Layout Options | Width: Wide Color: