• Resolved futureyoon

    (@futureyoon)


    Hi

    sometimes we got an user registered with very long and machine-created-name like this screenshot.
    https://prnt.sc/xzhjmy
    7a12b2dd34ad27a3c94e1d8a75d814cf

    noticed that it’s happening when a user is registering via facebook. not sure what setting of facebook is causing this kind of wierd name, instead of taking the user’s facebook account name.

    Have you seen this kind of issue? and
    Is there a way to correct this behavior?

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Laszlo

    (@laszloszalvak)

    Hi @futureyoon

    Yes, we need to generated those unique and random usernames if we can not generate a valid username from the first name and last name that comes from the social media.
    What you need to know is that, WordPress doesn’t allow special characters such as cyrillic, arabic, kanji etc. characters in usernames. So from such first and last names ,we won’t be able to generate a username that WordPress allows.

    If you want to avoid these random usernames, then you could generate usernames with your own logic, by using the “nsl_registration_user_data” filter:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/

    Or in the Pro Addon we have options to ask usernames before the registration. If you are interested in that, then feel free to open a support ticket here:

    As on this forum we are only allowed to discuss topics related to the Free version.

    Best regards,
    Laszlo.

    Thread Starter futureyoon

    (@futureyoon)

    Thank you so much for quick response! almost real time ??

    How would the user look like with the “nsl_registration_user_data” (random user name)?
    How randome would the name look like? the question sounds wierd but I bet you know what I mean.

    Maybe some samples would be great to get some ideas..?

    Thank you

    Plugin Support Laszlo

    (@laszloszalvak)

    Hi @futureyoon

    If we can not generate a valid username from the first name and last name that comes from the provider, then the first parameter of the “nsl_registration_user_data” action contains “false” value for the username key.
    So basically you just need to run your custom username generating codes when it is false, otherwise simply return the original data ( so way we will generate a unique username from the first name last name when they are fine) , e.g.:

    add_filter('nsl_registration_user_data', function($userData, $provider){
        if(!$userData['username']){
            /**
             * modify $userData['username'] with your own logic then return the modified value
             */
            return $userData;
        }
    
        return $userData;
    },10,2);
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘weird login ID when user register via facebook’ is closed to new replies.