Skip to:

Filtering Login Username to Allow Spaces

  • aaclayton


    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,

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering Login Username to Allow Spaces’ is closed to new replies.
Skip to toolbar