You are here

function fbconnect_unregister in Facebook Connect 6

Same name and namespace in other branches
  1. 6.2 fbconnect.module \fbconnect_unregister()

Remove user from table fbconnect

Parameters

Int $fbuid: Facebook user id

Return value

A

2 calls to fbconnect_unregister()
fbconnect_post_remove_callback in ./fbconnect.module
The post-remove callback for facebook. Unlinks facebook account from the linked drupal one.
fbconnect_user_settings_form_submit in ./fbconnect.pages.inc
Handle post-validation user_settingsForm submission.

File

./fbconnect.module, line 770

Code

function fbconnect_unregister($fbuid) {
  if ($fbuid && ($uid = _is_fbconnect_user($fbuid))) {
    $fb = facebook_client();
    $fb->api_client
      ->auth_revokeAuthorization($fbuid);
    db_query('DELETE FROM {fbconnect_users} WHERE fbuid = %s', $fbuid);
    user_save(user_load($uid), array(
      'fbuid' => NULL,
    ));
    watchdog('fbconnect', "Users authorization is revoked (fbuid: @fbuid)", array(
      '@fbuid' => $fbuid,
    ));
    return TRUE;
  }
  $msg = __FUNCTION__ . ' is called with wrong $fbuid(@fbuid) argument ';
  watchdog('fbconnect', $msg, array(
    '@fbuid' => $fbuid,
  ), WATCHDOG_WARNING);
  return FALSE;
}