You are here

function fb_invite_access_cb in Drupal for Facebook 7.4

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

Menu access callback makes it possible to hide menu items when no local application is configured.

1 string reference to 'fb_invite_access_cb'
fb_invite_menu in contrib/fb_invite.module
Implements hook_menu().

File

contrib/fb_invite.module, line 28
Adds the ability to invite facebook friends to use the local Facebook Application.

Code

function fb_invite_access_cb() {
  $fb_app = fb_get_app();
  if ($fb_app) {

    // There is a current app.
    return TRUE;
  }
  else {

    // Let administrators understand why access is denied.
    if (user_access('access administration pages')) {
      drupal_set_message(t('No Facebook Application configured.  The fb_invite.module needs a <a href="!url">default application</a>.', array(
        '!url' => url(FB_PATH_ADMIN_CONFIG . '/settings/app'),
      )), 'error');
    }
    return FALSE;
  }
}