latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Validating Username

Home Forums Community Forum Validating Username

This topic contains 7 replies, has 2 voices. Last updated by  Jason (Lead Developer) 4 years, 10 months ago.

Topic Author Topic
Posted: Wednesday Feb 8th, 2012 at 4:00 pm #4494

I asked this question on the old forums- wasnt quite sure if those threads cross over to the new site.

My registration forms (paypal Pro) say no special characters .. but don’t validate for that at all.
Periods and @ cause a break in the profile areas .. so i’m wondering how to get the registrations to validate properly to avoid users activating a username that fails.

I’d currently prefer to block all special characters and spaces.
We have some users that even successfully pay in paypal with usernames like “Sam……….”
How can i safely edit their username without breaking their payment ids? – is that as easy as it sounds (export – edit while maintaining id and re-import again)

-grace

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Thursday Feb 9th, 2012 at 11:32 am #4639

Cristian,
I did post about this in the old forums .. but was not notified when you tried to respond.

http://www.primothemes.com/forums/viewtopic.php?f=4&t=17083

Any Username with: . ()/@ in it will break the profile in WP.
but S2 is still allowing underscores, periods, dashes and even whole email addresses with @ in them.

I need to get proper Username validation to kick in as soon as possible – since its even letting it occur with paid subscriptions.

Up til now i’ve hand- deleted any account with special characters – but once they pay that because a bigger problem .. since sometimes their username is already taken without characters.

Help!
: /

grace

Posted: Thursday Feb 9th, 2012 at 6:14 pm #4685
Staff Member

Hi Grace. Thanks for your inquiry.

Actually, WordPress does allow those characters in a Username. s2Member uses existing validation routines provided by the WordPress core, which make use of this framework function. Please see: http://codex.wordpress.org/Function_Reference/sanitize_user

alphanumeric characters plus these: _ space . - * @

Sorry if the Pro Form is misleading in this regard. s2Member encourages Users/Members to use only alphanumerics, but s2Member does need to obey the core framework routines also. If WordPress allows those characters, so will s2Member.

If you’re having trouble with these types of Usernames in Profiles, you might consider using the user_nicename field from the database, instead of the Username. WordPress stores the user_nicename field specifically for that purpose (i.e. for URL formulation).

If you continue to have trouble, please describe what you’re trying to accomplish exactly, and we’ll try to assist you. Where are the Profiles that are breaking? Is that in another plugin/theme perhaps? If so, you might try contacting the developer to see if they can use the user_nicename field instead.

Posted: Thursday Feb 9th, 2012 at 6:32 pm #4689

S2 and WP allow a Username to contain Capital as well as lowercase, dashes and underscores without any trouble.

But they also allow @ . which both result in the user’s profile not functioning because the page address now contains the . or @

Not quite sure if changing our db to nicenames is an option at this point since over 4,000 users have already activated based on Username.

Does nicename automatically pull username, cleaned?? If so what happens to duplicate names like “jeff@” versus “jeff” when you try to get to their profile page?

-grace

Posted: Thursday Feb 9th, 2012 at 9:47 pm #4709
Staff Member

Thanks for the follow-up.

Your installation of WordPress should already have user_nicename stored in the wp_users table for each User/Member; this happens automatically during registration via core WordPress functionality.

user_nicename is the same as user_login, except it’s sanitized by these three functions:
http://codex.wordpress.org/Function_Reference/remove_accents
http://codex.wordpress.org/Function_Reference/sanitize_title
http://codex.wordpress.org/Function_Reference/sanitize_title_with_dashes

In the event of a collision, WordPress will suffix user_nicename with “-2“, and if that fails, it will increment the value of “-2” until it finds a unique value when compared to other users.

when you try to get to their profile page?

What profile page are you referring to please? s2Member doesn’t use the Username in any URLs leading to a Profile page, and neither does WordPress that I’m aware of.

Posted: Thursday Feb 9th, 2012 at 9:57 pm #4711

:/ yeah unfortunately i can foresee a good deal of trouble in making that switch.
If the login becomes the sanitized name.. there is no way to effectively let every user know their new login name without disrupting the flow yet again ( this is a very newly launched product cross over)

So if they activated Username “Sam……” the sanitized version would try “Sam” and if taken, add the “Sam-2” and that is what the user would need to input to login.

ugg.

Upsetting as it is I’d retain more users by manually continuing to delete new user accounts that d;i[ through with periods or @

Posted: Thursday Feb 9th, 2012 at 10:00 pm #4712

Every user in Buddypress gets a profile page.
So the addy becomes http://video.icu2.com/Username/

Our customer base would absolutely not survive on real names.. so Username being unchangeable is a problem in itself that we are trying to handle as smoothly as possible.

Everything is linked to a chat system that uses that Username as the avatar — so symbols dont bother anything there.. but defining the username as the login is already in place.
-grace

Posted: Thursday Feb 23rd, 2012 at 1:06 am #6050
Staff Member

Hi there. So sorry that I abandoned you here.
~ It was NOT intentional, so sorry.

So if they activated Username “Sam……” the sanitized version would try “Sam” and if taken, add the “Sam-2″ and that is what the user would need to input to login.

Well the Username will always function as a way to log into the site. The nicename is there to use with anything you’re integrating with that might choke on some characters that WordPress allows in a Username. So each account actually has two Username’s. One that’s used for logging into the site (always unique), and another that’s used as a way to reference that User in URLs, where URL-encoding the Username might not work either. The nicename field is also unique.

In either case, with WordPress, you really are forced to make your applications jive with the characters allowed by the core, or change the characters allowed by the core. If you wanted to change the characters, you could modify the behavior of the sanitize_user() function that comes with WordPress, or perhaps create a custom Pro Form template of your own, which modifies validation routines slightly during registration.

Pre Sale FAQs » Is it possible to modify s2Member® Pro Form templates?

Viewing 7 replies - 1 through 7 (of 7 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.