• seand11

    (@seand11)


    This plugin currently allows spaces and other characters in wp_users.user_nicename which is a problem for generating author links which will 404 because of the space (%20) and other characters.

    diff --git a/wp-content/plugins/wordpress-social-login/includes/plugin.auth.php b/wp-content/plugins/wordpress-social-login/includes/plugin.auth.php
    index 05a0b4c..f42a944 100644
    --- a/wp-content/plugins/wordpress-social-login/includes/plugin.auth.php
    +++ b/wp-content/plugins/wordpress-social-login/includes/plugin.auth.php
    @@ -138,7 +138,7 @@ function wsl_process_login()
    
     			'first_name'    => $hybridauth_user_profile->firstName,
     			'last_name'     => $hybridauth_user_profile->lastName,
    -			'user_nicename' => $hybridauth_user_profile->displayName,
    +			'user_nicename' => $user_login,
     			'display_name'  => $hybridauth_user_profile->displayName,
     			'user_url'      => $hybridauth_user_profile->profileURL,
     			'description'   => $hybridauth_user_profile->description,
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter seand11

    (@seand11)

    Additionally here is how you can update existing improper user_nicenames from your database with SQL:

    First, get a list of user_nicenames with spaces:

    SELECT user_nicename FROM wp_users WHERE user_nicename LIKE '% %'

    If it looks good, update to replace the space with underscores:

    UPDATE wp_users
    SET user_nicename = replace(user_nicename, ' ', '_')
    WHERE user_nicename LIKE '% %'

    Works like a charm. Not only author links it also breaks user (user profile) permalinks when using bbpress plugin.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Creates invalid user_nicename [PATCH]’ is closed to new replies.