You are here

function fb_user_authentication_is_required in Drupal for Facebook 5.2

Determines whether authentication is required to serve the current page. This will return true if the application has been configured to require login for all canvas pages. Except in special cases, such as profile tabs.

Return value

TRUE only for canvas pages if authentication is required to use the application and the page is not a special exception to the rule.

1 call to fb_user_authentication_is_required()
fb_user_fb in ./fb_user.module
Implementation of hook_fb.

File

./fb_user.module, line 280
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_authentication_is_required($fb_app) {
  $fb_app_data = fb_app_get_data($fb_app);
  $fb_user_data = $fb_app_data['fb_user'];

  // our configuration
  if ($fb_user_data['require_login'] == FB_USER_OPTION_REQUIRE_LOGIN) {

    // The application is configured to require login on all canvas pages.
    // However, there are exceptions.
    if (isset($_REQUEST['fb_sig_in_profile_tab']) && $_REQUEST['fb_sig_in_profile_tab']) {

      // Redirects are not allowed for the profile tab.
      return FALSE;
    }

    // There may be other exceptions, for example some ajax callbacks.  Potential todo item.
    // No exceptions apply, authentication is required.
    return TRUE;
  }
}