Support » Plugin: WP-Members: Membership Framework » usable symbols for username

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler


    There is not a direct answer for that since it is dependent upon certain elements of WordPress. The plugin uses the WP function validate_username to during registration to determine the validity of a requested username. Since validate_username can be filtered, and it uses the function sanitize_user which can also be filtered, the answer to what is a usable symbol is “it depends.”

    In most cases, if you aren’t changing anything with WP’s username validation, it is going to remove unsafe characters (tags, octets, and entities).

    If $strict is true for sanitize_user, then it will remove all non-ASCII characters, which essentially leaves you with alphanumeric characters plus _, ., -, *, @, and space.

    So if you want to limit it, you can do so with the sanitize_user filter.

    There is also an action hook in the plugin that would allow you to do your own validation. wpmem_pre_register_data comes after all the default validation is complete, but before the user is inserted. That would be the final point to hook into and return an error based on any criteria you wanted (such as not allowing spaces in usernames even if WP’s sanitize_user is strict, which would allow them).

    Thank you for your kind reply.
    It helps me a lot.

    Best Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘usable symbols for username’ is closed to new replies.