You are here

function fb_devel_fb in Drupal for Facebook 5

Same name and namespace in other branches
  1. 5.2 fb_devel.module \fb_devel_fb()
  2. 6.3 fb_devel.module \fb_devel_fb()
  3. 6.2 fb_devel.module \fb_devel_fb()
  4. 7.4 fb_devel.module \fb_devel_fb()
  5. 7.3 fb_devel.module \fb_devel_fb()

File

./fb_devel.module, line 22

Code

function fb_devel_fb($fb, $fb_app, $op, &$return, $data) {
  if ($op == FB_OP_INITIALIZE) {

    // Sanity check.
    $nid = fb_settings(FB_SETTINGS_APP_NID);
    if ($nid != $fb_app->nid) {
      $message = t('fb_app id (%fb_app_id) does not equal fb settings id (%fb_settings_id).  This is usually caused by the wrong callback url on your <a href="!url">facebook application settings form</a>.', array(
        '%fb_app_id' => $fb_app->nid,
        '%fb_settings_id' => $nid,
        '!url' => "http://www.facebook.com/developers/apps.php",
      ));
      drupal_set_message($message, 'error');
      watchdog('fb_devel', $message);
    }

    // Theme sanity check
    global $theme;

    // for debug message
    if (isset($theme)) {
      $message = t('Drupal for Facebook is unable to override the theme settings.  This is usually because some module causes theme_init() to be invoked before fb_init().  See the !readme.', array(
        '!drupal_for_facebook' => l(t('Drupal for Facebook'), 'http://drupal.org/project/fb'),
        // This link should work with clean URLs
        // disabled.
        '!readme' => '<a href=' . base_path() . '/' . drupal_get_path('module', 'fb') . '/README.txt>README.txt</a>',
      ));
      drupal_set_message($message, 'error');
      watchdog('fb_devel', $message);
    }
  }
}