This topic has 8 replies, 5 voices, and was last updated 10 years by edecastro05.
-
Author
-
August 24, 2013 at 12:02 #1749mcgreggorParticipant
Users who register with spaces in their username (e.g. “John Zorn”) aren’t able to log in because the spaces are converted to hypens (e.g. “john-zorn”). The user however is unaware of this and will try to login with the spaces and uppercase characters resulting in an “unknown user” error.
This bug is not related to your theme but a general Buddypress bug. For now I added some instructions below the field by editing general-register-modal but I was wondering if it’s possible to add extra validation to the name field so that spaces and uppercase characters are no longer allowed?
August 26, 2013 at 10:26 #1794SQadminKeymasterHi,
You can restrict users from registering with space in the username:COPY CODEadd_action('bp_init','bpdev_remove_bp_pre_user_login_action'); function bpdev_remove_bp_pre_user_login_action(){ remove_action( 'pre_user_login', 'bp_core_strip_username_spaces' ); } //add a filter to invalidate a username with spaces add_filter('validate_username','bpdev_restrict_space_in_username',10,2); function bpdev_restrict_space_in_username($valid,$user_name){ //check if there is an space if ( preg_match('/\s/',$user_name) ) return false;//if myes, then we say it is an error return $valid;//otherwise return the actual validity }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 30, 2013 at 01:39 #3533SQadminKeymasterHi, This goes to sweetdate-child/functions.php
Make sure to have the child theme activatedHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 13, 2014 at 05:16 #22463edecastro05ParticipantHello Robert,
Would you be able to repost the code? The link appears it has expired.
Thank youJuly 18, 2014 at 16:47 #22948AbeKeymasterHello, I have updated the code above. Droplr files seem that are no longer accessible.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The topic ‘Buddypress bug: users with spaces in their usernames can’t register’ is closed to new replies.