You are here

function fbconnect_get_fbname in Facebook Connect 5

Get the facebook username

Parameters

integer $fbuid: Facebook user id

2 calls to fbconnect_get_fbname()
fbconnect_register_form in ./fbconnect.module
This form is display when we register a new user.
fbconnect_register_page in ./fbconnect.module
Menu callback. Called when user perform facebook registration

File

./fbconnect.module, line 856
This module allows site visitors to connect and register with facebook account

Code

function fbconnect_get_fbname($fbuid) {
  if (facebook_client()) {
    try {
      $result = facebook_client()->api_client
        ->users_getStandardInfo($fbuid, array(
        'name',
      ));
      return check_plain($result[0]['name']);
    } catch (Exception $e) {
      watchdog('fbconnect', 'Exception thrown while calling users_getStandardInfo: !code', array(
        '!code' => $e
          ->getMessage(),
      ), WATCHDOG_WARNING);
    }
  }
}