Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2011, 05:13 PM
Raphaelx Raphaelx is offline
 
Join Date: Apr 2007
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [SOLVED MYSELF] shorten Usernames for Facebook-registrations (last name)

Hi,

I want to shorten usernames for users registered with FB-Connect.
"Rapahel Example" -> "Raphael E."

how do I realize that?

--------------- Added [DATE]1305490636[/DATE] at [TIME]1305490636[/TIME] ---------------

got it myself, here is how
  1. browse to /includes/
  2. open "class_facebook.php"
  3. go to
    PHP Code:
    public function getFbUserInfo($force_reload = false) 
    
  4. find
    PHP Code:
    $this->fb_userinfo = $response[0]; 
    
  5. add next line
    PHP Code:
    $this->fb_userinfo['name'] = shortenFBusername( $this->fb_userinfo['name'] ); 
    
  6. find
    PHP Code:
            // now return the user info if we got any
            return $this->fb_userinfo;
        } 
    
  7. add after
    PHP Code:
    function shortenFBusername( $u ) {
      return substr( $u, 0, -( strlen( $u ) - strpos( $u, " " ) )+2 ) . '.';
    } 
    
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:54 PM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.