Filtering Login Username to Allow Spaces
Hi BP community,
I have a bit of a conundrum and could use a hand! Permanent member identity within the community is important for my site, so users do not have the ability to modify their Display Name, and are forced to use the name they select at registration.
In order to have valid nicenames and URLs, BuddyPress replaces spaces or other special characters with hyphens when saving users to the database. If a user were to register as “John Doe”, he would need to login with the username “john-doe”.
While this is fine, and doesn’t cause any issues for the site, I do have to deal with a number of contact form submissions from confused users who are unable to login as “John Doe”. What I would like to do, is filter wp_authenticate (or somewhere else if appropriate) to grab a user’s submitted username and str_replace spaces with hyphens for them before the login request is processed.
I’ve tried my hand at filtering $username in ‘authenticate’ in a manner similar to the suggestion provided here:
Unfortunately I have not been successful, so any advice from the community on handling this would be awesome!
Thanks very much,
- The topic ‘Filtering Login Username to Allow Spaces’ is closed to new replies.