Special Characters in Username

Discussion in 'aMember Pro v.4' started by sheila_r, Feb 23, 2013.

  1. sheila_r

    sheila_r aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    14
    Hello. It is my understanding that aMember allows for numbers, letters, and underscores in the username. I also see that there is an option in the control pane that we can allow spaces in the username. I have the following questions:

    1) Are there any disadvantages of allowing spaces in the username? I assume that the main potential disadvantage would be if a third party system does not support the use of spaces, but am not sure if there are any other disadvantages.

    2) Is it possible to configure aMember so that it accepts hyphens (in addition to underscores)? If so, how is this done?

    We have a large number of users that we will be integrating with the aMember system and I am trying to figure out if I will need to edit all of their log in names, so that they do not contain spaces or hyphens.

    Thank you.
  2. zenpig66

    zenpig66 aMember Pro Customer

    Joined:
    Jan 1, 2009
    Messages:
    70
    I haven't played much with it in 4.x like I did with 3.x(am adhering more to not allowing special characters due to 3rd party scripts that may be introduced in the future) but just looking at the code I believe you should be able to adjust what characters you need to by editing amember/application/default/models/User.php at the LoginRegex function around line 531. Allowing spaces I don't think is as large of a deal as hyphens though depending on what you are working with neither more than likely matters......it's hard to give advice on that due to so many possibilities out there. Just don't go overboard on what you do allow ;)
  3. rosieowl

    rosieowl aMember Pro Customer

    Joined:
    May 28, 2009
    Messages:
    15
    We upgraded to v4 last week. It turns out that we have a few usernames that have special characters in them. Not sure how - think they must have been added manually in admin account back in v3 - oops! Anyway, they have all imported fine as part of the upgrade (done by aMember). Usernames with certain special characters are causing login problems. So far though, (on all the ones we've checked) usernames containing hyphens are logging in fine.

    I'm not suggesting that it's a great idea to use special characters but it seems that while you can't create usernames with special characters in v4, you can import them and in our experience they 'can' work for logging in. There may well be other problems ahead that we haven't anticipated as we are only a few days into our v4 adventure. As pp says they could be an issue if you were trying to integrate with third party scripts.

    I think that over time we will try to convert all usernames away from special characters but for now it is really handy that some of them are logging in fine - giving us time to sort out the ones that aren't currently logging in.
  4. zenpig66

    zenpig66 aMember Pro Customer

    Joined:
    Jan 1, 2009
    Messages:
    70
    One problem you'll run into, rosieowl, is if you left the LoginRegex function default for the v4 install you won't be able to update passwords or any other info via aMember for those that are using anything like hyphens. Like you all of the members usernames imported fine for me but if you try to update info for them on the "User Info" page in aMember you'll get an error concerning the username. You can test that yourself by finding one using a special character and just try adding some text in the comments text field.
  5. rosieowl

    rosieowl aMember Pro Customer

    Joined:
    May 28, 2009
    Messages:
    15
    Thank you for the warning zenpig. We have just run headfirst into that issue this evening. Hopefully there aren't too many of them and they won't mind too much having their usernames changed.
  6. sheila_r

    sheila_r aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    14
    Hi all. Thanks for the replies. We ended up doing a manual change of all usernames that include hypehens and/or spaces. It took some time to do, but should help to ensure better compatibility with other plugins in the future.

Share This Page