Skip to:
Content
Pages
Categories
Search
Top
Bottom

Filtering Login Username to Allow Spaces

  • Avatar of aaclayton
    aaclayton
    Participant

    @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:

    http://stackoverflow.com/questions/1805185/how-do-i-hook-into-the-wordpress-login-system-to-stop-some-users-programmaticall

    Unfortunately I have not been successful, so any advice from the community on handling this would be awesome!

    Thanks very much,
    Andrew

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

You must be logged in to reply to this topic.