You are here

function fbconnect_user in Facebook Connect 5

Same name and namespace in other branches
  1. 6.2 fbconnect.module \fbconnect_user()
  2. 6 fbconnect.module \fbconnect_user()

Implementation of hook_user().

File

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

Code

function fbconnect_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'load':
      $data = db_fetch_array(db_query('SELECT fbuid, timestamp, visibility FROM {fbconnect_users} WHERE uid = %d', $account->uid));
      $account->fbuid = $data['fbuid'];
      $account->fb_visibility = $data['visibility'];
      break;
    case 'delete':
      if ($account->fbuid) {
        db_query('DELETE FROM {fbconnect_users} WHERE uid = %d', $account->uid);
        db_query('DELETE FROM {fbconnect_profile} WHERE uid = %d', $account->uid);
      }
      break;
    case 'logout':
      if (fbconnect_get_fbuid()) {
        drupal_goto(NULL, 'fblogout=true');
      }
      break;
  }
}