'fb/devel', 'callback' => 'fb_devel_page', 'type' => MENU_CALLBACK, 'access' => TRUE, // TODO: restrict access ); $items[] = array('path' => 'fb/devel/fbu', 'callback' => 'fb_devel_fbu_page', 'type' => MENU_CALLBACK, 'access' => TRUE, ); } return $items; } 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 facebook application settings form.', 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' => 'README.txt')); drupal_set_message($message, 'error'); watchdog('fb_devel', $message); } } } /** * Provides a page with useful debug info. * */ function fb_devel_page() { global $fb, $fb_app; global $user; if ($_REQUEST['require_login']) $fb->require_login(); else if ($_REQUEST['require_add']) $fb->require_add(); if ($fb) { // These will work in a canvas page. drupal_set_message("in_fb_canvas returns " . $fb->in_fb_canvas()); drupal_set_message("get_loggedin_user returns " . $fb->get_loggedin_user()); drupal_set_message("current_url returns " . $fb->current_url()); drupal_set_message("base_url: " . $GLOBALS['base_url']); drupal_set_message("base_path: " . $GLOBALS['base_path']); drupal_set_message("session_key is " . $fb->api_client->session_key); } if ($fbu = fb_get_fbu($user)) { $path = "fb/devel/fbu/$fbu"; drupal_set_message(t("Learn more about the current user at !link", array('!link' => l($path, $path)))); } dpm(fb_get_fbu($user), 'Facebook user via fb_get_fbu'); //dpm($user, "Local user " . theme('username', $user)); //dpm($_COOKIE, 'cookie'); //dpm($_REQUEST, "Request"); //dpm($fb_app, "fb_app"); //drupal_set_message("session_id returns " . session_id()); //dpm($_SESSION, "session:"); return "This is the facebook debug page."; } /** * A page which tests function which work with facebook user ids */ function fb_devel_fbu_page($fbu = NULL) { if ($fbu) { $output = "
Debug info about facebook id $fbu:
\n"; $friends = fb_get_friends($fbu); //dpm($friends, "fb_get_friends($fbu) returned"); $items = array(); foreach ($friends as $_fbu) { $items[] = l($_fbu, "fb/devel/fbu/{$_fbu}"); } if (count($items)) { $output .= "\nKnown friends:
Local friends: