You are here

function fb_user_post_add_check in Drupal for Facebook 5

This method will redirect a user if the post-add page need not be displayed.

If replacing the normal post-add page with a custom implementation, do call this.

1 call to fb_user_post_add_check()
fb_user_post_add_cb in ./fb_user.module
The post-add page is where the user is sent after adding the application.

File

./fb_user.module, line 55
This module allows Drupal user records to be associated with Facebook user ids. It can create local user accounts when Facebook users visit an application's canvas pages.

Code

function fb_user_post_add_check() {
  global $fb, $fb_app, $user;

  // This page is for canvas pages only
  if (!$fb) {
    drupal_access_denied();
    exit;
  }

  // redirect will be set if we've called $fb->require_add.  In this case
  // we forward the user on.
  if ($_REQUEST['redirect']) {
    if (function_exists('fb_canvas_fix_url')) {

      // Redirect to a canvas page
      $url = fb_canvas_fix_url($_REQUEST['redirect'], $fb_app);
      if (fb_verbose()) {
        watchdog('fb_debug', "post_add_check redirecting to {$url}");
      }
      $fb
        ->redirect($url);
      exit;
    }
    else {

      // XXX is this still necessary?
      _fb_user_sync_redirect($_REQUEST['redirect']);
    }
  }

  // This function returns only if post add page needs to be rendered.  Otherwise user is redirected.
}