• Resolved dieutridau

    (@dieutridau)


    Recently, after upgrading a number of plugins, the site does not allow members with space in username to login the web. Meanwhile, members who sign up using OA social login create spaces in the username, so they cannot login to the web. Is there any way to solve it ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Claude

    (@claudeschlesser)

    Hello,

    to remove any spaces from the user’s login, you can simply use this filter:

    function oa_social_login_filter_user_fields ($user_fields)
    {
      $user_fields['user_login'] = str_replace(' ', '', $user_fields['user_login']);
      return $user_fields;
    }
     
    //This filter is applied to new users
    add_filter('oa_social_login_filter_new_user_fields', 'oa_social_login_filter_user_fields');

    The code must be added to the end of the functions.php file of your WordPress theme. By doing so your changes will not be overwritten when you install a new version of Social Login. You can find this file in your WordPress admin area under Appearance \ Editor \ Theme Functions (functions.php)

    Do not hesitate to ask if I can be of any help.

    • This reply was modified 4 years, 5 months ago by Claude.
    Thread Starter dieutridau

    (@dieutridau)

    Thanks a lot

    Hi @claudeschlesser

    I have the same problem with BuddyPress, but when I tried to past your code (with modifications), it does not work, can you help me ?

    Thank you

    function login_filter_user_fields ($user_fields)
    {
      $user_fields['user_login'] = str_replace(' ', '', $user_fields['user_login']);
      return $user_fields;
    }
     
    //This filter is applied to new users
    add_filter('login_filter_new_user_fields', 'login_filter_user_fields');
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error with space in username’ is closed to new replies.