Forums

[Plugin: WP-FacebookConnect] change user name to something else that fbN (5 posts)

  1. obvio
    Member
    Posted 2 years ago #

    is there a way to change somehow the user name to something more meaningful? I use this plugin to enable passing by users to post, so when their post is approved and you click them as the author what you get is this *not nice* url: ../author/fb98734987 , is there any way around it?
    thanks!

    http://wordpress.org/extend/plugins/wp-facebookconnect/

  2. Juani
    Member
    Posted 2 years ago #

    yes, open te common.php file in line ~194 and change this:
    $fbusername = 'fb'.$fbuid;

    for this:

    $counter = 1;
      $fbusername = str_replace( ' ', '', $userinfo['name'] );
      if (username_exists($fbusername)) {
    	do
            {
                $username = $fbusername;
                $counter++;
                $username = $username . $counter;
            } while ( username_exists( $username ) );
        }
        else
        {
            $username = $fbusername;
        }
        $username = strtolower( sanitize_user($username) );
    
      $userdata = fbc_userinfo_to_wp_user($userinfo);
      $userdata['user_pass'] = wp_generate_password();
      $userdata['user_login'] = $username; //login with new nice username
      $userdata['user_nicename']= $username; //show name with new nice username

    you can see in action in my video soccer site http//futborama.com

  3. obvio
    Member
    Posted 2 years ago #

    gracias Juani!

  4. Juani
    Member
    Posted 2 years ago #

    de nada!
    Espero que te sirva, cualquier cosa preguntame

  5. obvio
    Member
    Posted 2 years ago #

    Che Juani,

    I've noticed that it ads the user without spaces, so NAME SURNAME becomes user NAMESURNAME, got any solution for that? maybe adding - or _ or %20?

    gracias!
    pd. te escribo en ingles para que todos lo disfruten.

Topic Closed

This topic has been closed to new replies.

About this Topic