You are here

function fb_infinite_nodeapi in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 fb_infinite.module \fb_infinite_nodeapi()

File

./fb_infinite.module, line 118
This module manages an infinite session for each Facebook App. http://wiki.developers.facebook.com/index.php/Infinite_session_keys

Code

function fb_infinite_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($node->type == 'fb_app') {
    if ($op == 'submit') {
      $fb_app_data = $node->fb_app_data;
      $fb_infinite_data = $fb_app_data['fb_infinite'];

      // This is an attempt to make the one-time code work.  I can't figure it out.
      // http://forum.developers.facebook.com/viewtopic.php?pid=76361#p76361
      if ($code = $fb_infinite_data['code']) {
        drupal_set_message("code is {$code}");
        $fb = fb_api_init($fb_app, FB_FBU_CURRENT);

        // Does not set user.
        $session = $fb->api_client
          ->auth_getSession($code);

        //dpm($session, "auth_getSession returned");
      }
    }
  }
}