You are here

function fb_rules_fb_user in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.3 contrib/fb_rules.module \fb_rules_fb_user()

Implementation of hook_fb_user().

File

contrib/fb_rules.module, line 11
Rules integration for the Drupal for Facebook module.

Code

function fb_rules_fb_user($op, $data, &$return) {
  global $user;
  $fb_app = isset($data['fb_app']) ? $data['fb_app'] : NULL;
  $fb = isset($data['fb']) ? $data['fb'] : NULL;

  // Use devel module to figure out when this hook is called and what it is passed.
  // dpm(func_get_args(), "fb_rules_fb($op) called"); // debug
  if ($op == FB_USER_OP_POST_USER_CONNECT) {

    // User connected local account with FB account
    rules_invoke_event('fb_user_connected', $user);
  }
  elseif ($op == FB_USER_OP_POST_USER_DISCONNECT) {

    // User disconnected local account from FB account
    rules_invoke_event('fb_user_disconnected', $user);
  }
  elseif ($op == FB_USER_OP_POST_EXTERNAL_LOGIN) {

    // User logged in through FB
    rules_invoke_event('fb_user_login', $user);
  }
}