1
justinh830
How do allow new users to create usernames that include spaces
  • 2007/7/4 20:09

  • justinh830

  • Just popping in

  • Posts: 9

  • Since: 2007/7/4 0


Hello,

I am trying to allow my site's users to register with usernames in this format: "firstname lastname". This is not working because they get the following error:

ERROR: Invalid Username
There cannot be any spaces in the Username.

After they register with a username that does not include a space, I can go in and change their username to the desired "first last" format.

Is there a way to just allow them to include a space in their username when they register to begin with?

Thank you,
Justin

2
BlueStocking
Re: How do allow new users to create usernames that include spaces

Justin,
you are dealing with computer language and what it can and cannot recognize. Some naming conventions are just not allowed. It's universal. Not optional. A space is represented by %20 (computer language) -- so you have as a username firstmane%20lastname.

The running program may recognize the end of line by a %20 thus adruptly ending the program from running the next data field.

That is not exactly it but close enough to give you an idea as to why it is not permitted to use spaces in some data fields.
hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

3
justinh830
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 20:59

  • justinh830

  • Just popping in

  • Posts: 9

  • Since: 2007/7/4 0


If that is the case, then why can I log in as an administrator and change their username to include a space? They are able to log in using a space, they just can't create it that way.

Any ideas?

4
davidl2
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 21:02

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


Admins can override the default filtering.

If you need to have a space, you basically need to find the relevent code in the register script, and ammend it to disable space-stopping.

My suggestion would be to backtrack from the error message and see what the code is to detect that..

5
davidl2
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 21:04

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


I think you need to comment out:

if (strrpos($uname, ' ') > 0) {
$stop .= _US_NICKNAMENOSPACES."
";

from register.php

(but can someone with coding knowledge confirm this before you tackle it? Thanks)

6
justinh830
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 21:05

  • justinh830

  • Just popping in

  • Posts: 9

  • Since: 2007/7/4 0


David,

Thanks for the info. I was pretty sure it was something that could be done.

Howver, I am not quite sure how to do that. How would I backtrack from the error message?

Justin

7
davidl2
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 21:06

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


See my previous post - I think we posted around the same time

8
justinh830
Re: How do allow new users to create usernames that include spaces
  • 2007/7/4 22:42

  • justinh830

  • Just popping in

  • Posts: 9

  • Since: 2007/7/4 0


Can anyone confirm that David's idea is what I should do?

I don't want to mess with something that could cause problems, unless I am pretty sure it will work, problem free.

Thanks.

9
iHackCode
Re: How do allow new users to create usernames that include spaces

i agree with david's suggestion

to comment out.
[d] if (strrpos($email,' ') > 0) {
        
$stop .= _US_EMAILNOSPACES.'';
    }[/
d]


oops i pasted wrong thing. .look at blue's post below.

(happy 4th. )
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

10
BlueStocking
Re: How do allow new users to create usernames that include spaces

Quote:

if (strrpos($uname, ' ') > 0) {
$stop .= _US_NICKNAMENOSPACES."
";


IF
String positions 'space' in the user name is greater than zero, then stop.

Now, we are referring to the string position of jane" "doe. The space is ALWAYS going to equal = "20" the number to indicate a space to the computer and it is always greater than ">" zero. So we can depend on that code line to trap that space before it causes trouble.

Now the computer understands if it sees a space it is to sidetrack and go to the instructions in _US_NICKNAMENOSPACES and determine the appropiate route to take before completeing the command.

You may short circuit it, but for what purpose.
The code was put there to be compatable with what the computer and the program was designed to do.
Since they called the function US NICKNAME NO SPACES, I would think it was designed to tell us US NICKNAMES should not have spaces. Programers do that with code to remember and give other programers a hint as to why they performed a particular function.

It is changeable, but unless you have a good reason for doing it I would leave it alone, you or I don't know what trouble it may cause further down the line. And to trouble shoot code later that has been manually changed from the original is unnecessarly hard.

That is only my opinion.
No better, no worse than anyone elses.
hhttps://xoops.org/modules/repository .. It is time to get involved - XOOPS.ORG

Login

Who's Online

328 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 328


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits