To install:
-- Make sure you have an up-to-date PHP client from facebook.
+- Make sure you have a PHP client from facebook (version < 3.0.0).
+ The 3.0.0 or higher versions are not supported by this version of Drupal for Facebook.
Download from http://github.com/facebook/php-sdk.
Extract the files, and place them in sites/all/libraries/facebook-php-sdk.
If you have the Libraries API module installed, you may place the files in
another recognised location (such as sites/all/libraries), providing that the
directory is named 'facebook-php-sdk'.
-
+
Or, to manually set the location of the php-sdk in any other directory, edit
your settings.php to include a line similar to this (add to the section where
the $conf variable is defined, or the very end of settings.php. And
See also http://drupal.org/node/923804
-- Your theme needs the following attribute at the end of the <html> tag:
-
- xmlns:fb="http://www.facebook.com/2008/fbml"
-
- Typically, this means copying the html.tpl.php file from /modules/system into the
- templates folder of your theme and modifying it. More detail can be found at
- http://www.drupalforfacebook.org/node/1106. Note this
- applies to themes used for Facebook Connect, iframe Canvas Pages, and Social
- Plugins (i.e. like buttons). Without this attribute, IE will fail.
-
- To support canvas pages and/or page tabs, url rewriting and other
settings must be initialized before modules are loaded, so you must
add this code to your settings.php. This is done by adding these
fb_devel.module will catch some errors and write useful information to
Drupal's log and status page.
-Disable Global Redirect, if you have that module installed. Users
+Use your browser's view source feature, and search page source for any
+<script> tag which includes facebook's javascript,
+"http://connect.facebook.net/en_US/all.js". fb.js will include this
+for you. Including it too soon will break many features. So remove
+it from any block, node, template or whatever that adds it to the
+page. Similarly, do not include any <div id="fb-root">.
+
+Disable Global Redirect, if you have that module installed. Users
have reported problems with it and Drupal for Facebook. Any module
which implements custom url rewrites could interfere with canvas page
and profile tab support.
// More efficient connect session discovery.
// Required if supporting one connect app and different canvas apps.
-//$conf['fb_apikey'] = '123.....XYZ'; // Your connect app's apikey goes here.
+//$conf['fb_id'] = '123.....XYZ'; // Your connect app's ID goes here.
// Enable URL rewriting (for canvas page apps).
include "sites/all/modules/fb/fb_url_rewrite.inc";
'type' => 'int',
'not null' => TRUE,
'default' => 0),
- 'label' => array( /* Would it be better to store apikey? */
+ 'label' => array( /* Would it be better to store id? */
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
* http://developers.facebook.com/docs/test_users
*/
+/**
+ * Implements hook_menu().
+ */
function fb_test_menu() {
// Admin pages
return $output;
}
-function fb_test_create_form(&$form, &$form_state, $fb_app) {
+function fb_test_create_form($form, &$form_state, $fb_app) {
$form['#fb_app'] = $fb_app;
// @TODO make this a dropdown, limit to 50 total test accounts.
// Which permissions?
$perms = array();
drupal_alter('fb_required_perms', $perms); // @TODO pass fb_app to this function.
- if (count($perms)) {
- $default_perms = implode(',', $perms);
- }
+ $default_perms = count($perms) ? implode(',', $perms) : '';
$form['perms'] = array(
'#type' => 'textfield',
'permissions' => $values['perms'],
'access_token' => fb_get_token($fb),
));
+ dpm($result, __FUNCTION__);
+ if (isset($result['id'])) {
+ drupal_set_message(t("Created user !name. Email: %email | Password: %password", array(
+ '!name' => "<fb:name uid=" . $result['id'] . "></fb:name>",
+ '%email' => $result['email'],
+ '%password' => $result['password'],
+ )));
+ }
}
- drupal_set_message(t('Created %num test accounts.', array('%num' => $values['how_many'])));
+ drupal_set_message(t('Created %num test accounts. Please make note of passwords (they will not be available again).', array('%num' => $values['how_many'])));
}
catch (Exception $e) {
fb_log_exception($e, t('Failed to create test accounts.'));
'access_token' => $test_account['access_token'], // Only when account is authorized
));
if ($data['name']) {
- $markup .= " $data[name] <a href=$data[link]>(profile)</a> ";
+ $markup .= " $data[name] (<a href=$data[link]>profile</a> | <a href=https://graph.facebook.com/{$test_account[id]}?access_token={$test_account[access_token]}>graph</a> | <a href=https://graph.facebook.com/{$test_account[id]}?access_token=" . fb_get_token($fb) . ">graph2</a>) ";
}
}
$props_map = array(
t('Name') => 'name',
t('Label') => 'label',
- t('API Key') => 'apikey',
t('ID') => 'id',
);
$output = "<dl>\n";
$props_map = fb_invoke(FB_ADMIN_OP_LIST_PROPERTIES, array('fb_app' => $fb_app), $props_map, FB_ADMIN_HOOK);
}
- if (!isset($cache[$fb_app->apikey])) {
+ if (!isset($cache[$fb_app->id])) {
if ($fb = fb_api_init($fb_app)) {
try {
$props = fb_call_method($fb, 'admin.getAppProperties', array(
'properties' => implode(',', array_values($props_map)),
));
- $cache[$fb_app->apikey] = $props;
+ $cache[$fb_app->id] = $props;
} catch (Exception $e) {
fb_log_exception($e, t('Failed to get application properties (%label) from Facebook', array('%label' => $fb_app->label)));
}
}
}
else {
- $props = $cache[$fb_app->apikey];
+ $props = $cache[$fb_app->id];
}
// Update $fb_app with the values we got from facebook api.
if ($include_current)
$options[FB_APP_CURRENT] = t('<current>');
foreach ($apps as $app) {
- if ($key == 'apikey') {
- $options[$app->apikey] = $app->label;
+ if ($key == 'id') { // Still needed?
+ $options[$app->id] = $app->label;
}
else {
$options[$app->label] = $app->label;
'#type' => 'checkbox',
'#title' => t('Set FB Cookie'),
'#default_value' => variable_get(FB_VAR_USE_COOKIE, TRUE),
- '#description' => t('Tell Facebook\'s libraries to set a cookie, named fbs_<em>APIKEY</em>, when user connects. Makes facebook applications run smoother, but fails when third-party cookies are denied by user\'s browser.'),
+ '#description' => t('Tell Facebook\'s libraries to set a cookie, named fbs_<em>ID</em>, when user connects. Makes facebook applications run smoother, but fails when third-party cookies are denied by user\'s browser.'),
);
$form['fb_admin_session'][FB_VAR_USE_SESSION] = array(
'#description' => t('Store tokens and data needed by facebook\'s libraries in Drupal\'s session. Helps applications work even when third-party cookies are denied.'),
);
+ $form['fb_admin_session'][FB_VAR_RELOAD_APPEND_HASH] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Append hash on javascript page reload'),
+ '#default_value' => variable_get(FB_VAR_RELOAD_APPEND_HASH, FALSE),
+ '#description' => t('When fb.js reloads (on session change), append a query parameter which serves two purposes. First, it will break through a cache which may be desireable when facebook session changes. Second, it prevents infinite reloads when third-party cookies are not enabled. Enable this if you encounter either of those problems.'),
+ );
+
$form['fb_admin_languages'] = array(
'#title' => t('Languages and Locales'),
'#type' => 'fieldset',
/**
* Reload the current page, whether on canvas page or facebook connect.
+ *
+ * append fbsig, a hash of the session data, to avoid infinite reloads
+ * in some cases.
*/
FB_JS.reload = function(destination) {
- // Determine fbu.
+ // Determine url hash.
var session = FB.getSession();
- var fbu;
+ var fbhash;
if (session != null)
- fbu = session.uid;
+ fbhash = session.sig; // Use sig rather than compute a new hash.
else
- fbu = 0;
+ fbhash = 0;
- // Avoid infinite reloads
+ // Avoid infinite reloads. Still needed? It would be nice to do away with this code if not needed.
///@TODO - does not work on iframe because facebook does not pass url args to canvas frame when cookies not accepted. http://forum.developers.facebook.net/viewtopic.php?id=77236
var vars = FB_JS.getUrlVars(window.location.href);
- if (vars.fbu == fbu) {
+ if (vars.fbhash == fbhash) {
return; // Do not reload (again)
}
path = destination.substr(0, destination.indexOf('?'));
}
- // Add fbu to params before reload.
- vars.push('fbu=' + fbu);
+ // Add fbhash to params before reload.
+ if (Drupal.settings.fb.reload_url_append_hash) {
+ vars.push('fbhash=' + fbhash);
+ }
// Use window.top for iframe canvas pages.
- destination = path + '?' + vars.join('&');
+ destination = vars.length ? (path + '?' + vars.join('&')) : path;
if(Drupal.settings.fb.reload_url_fragment) {
destination = destination + "#" + Drupal.settings.fb.reload_url_fragment;
// FB._apikey might be an apikey or might be an appid!
if (FB._apiKey == Drupal.settings.fb.fb_init_settings.appId ||
FB._apiKey == Drupal.settings.fb.fb_init_settings.apiKey) {
- request_data.apikey = Drupal.settings.fb.fb_init_settings.apiKey;
+ request_data.apikey = Drupal.settings.fb.fb_init_settings.apiKey; // deprecated
+ request_data.appId = Drupal.settings.fb.fb_init_settings.appId;
}
// Other values to pass to ajax handler.
define('FB_VAR_ID', 'fb_id');
define('FB_VAR_USE_COOKIE', 'fb_use_cookie');
define('FB_VAR_USE_SESSION', 'fb_use_session');
+define('FB_VAR_RELOAD_APPEND_HASH', 'fb_reload_append_hash');
define('FB_VAR_CURL_NOVERIFY', 'fb_curl_noverify');
// node_access realms (belongs here?)
// An App is configured.
// Javascript settings needed by fb.js.
- fb_js_settings('apikey', $_fb_app->apikey);
+ //fb_js_settings('apikey', $_fb_app->apikey); // deprecated XXX
fb_js_settings('label', $_fb_app->label);
fb_js_settings('page_type', fb_settings(FB_SETTINGS_TYPE)); // canvas or connect.
- $fb_init_settings['apiKey'] = $_fb_app->apikey;
+ //$fb_init_settings['apiKey'] = $_fb_app->apikey;
$fb_init_settings['appId'] = $_fb_app->id;
// Initialize the PHP API.
$_fb->setSession(json_decode($_REQUEST['fb_js_session'], TRUE));
$session = $_fb->getSession();
}
- elseif (isset($_SESSION['fb'][$_fb_app->apikey]['session']) && arg(0) != 'logout') {
+ elseif (isset($_SESSION['fb'][$_fb_app->id]['session']) && arg(0) != 'logout') {
// Use the session previously stored.
- $_fb->setSession($_SESSION['fb'][$_fb_app->apikey]['session']);
+ $_fb->setSession($_SESSION['fb'][$_fb_app->id]['session']);
}
// Store session for future use. We'll need it if third-party cookies
// disabled, or we are not using facebook's cookie.
if (isset($session) && variable_get(FB_VAR_USE_SESSION, TRUE)) {
- $_SESSION['fb'][$_fb_app->apikey]['session'] = $session;
+ $_SESSION['fb'][$_fb_app->id]['session'] = $session;
}
// Make javascript work even when third-party cookies disabled.
_fb_logout();
$_fb->setSession(NULL);
unset($session);
- unset($_SESSION['fb'][$_fb_app->apikey]);
+ unset($_SESSION['fb'][$_fb_app->id]);
unset($fb_init_settings['session']);
}
}
'fb_canvas' => fb_is_canvas(),
'language' => (object) array('prefix' => NULL, 'language' => NULL), // http://drupal.org/node/1000452
)));
-
+ fb_js_settings('reload_url_append_hash', variable_get(FB_VAR_RELOAD_APPEND_HASH, FALSE));
}
if ($channel = variable_get(FB_VAR_JS_CHANNEL, TRUE)) {
// or at least not overwrite previously declared handler.
set_exception_handler('fb_handle_exception');
- if (isset($cache[$fb_app->apikey])) {
- return $cache[$fb_app->apikey];
+ if (isset($cache[$fb_app->id])) {
+ return $cache[$fb_app->id];
}
// Find Facebook's PHP SDK. Use libraries API if enabled.
}
// Cache the result, in case we're called again.
- $cache[$fb_app->apikey] = $fb;
+ $cache[$fb_app->id] = $fb;
return $fb;
}
// Clean up facebook cookies.
if (isset($GLOBALS['_fb_app'])) {
- if (isset($_COOKIE['fbs_' . $GLOBALS['_fb_app']->apikey])) {
+ if (isset($_COOKIE['fbs_' . $GLOBALS['_fb_app']->apikey])) { // still needed?
setcookie('fbs_' . $GLOBALS['_fb_app']->apikey, '', time() - 42000, '/');
}
if (isset($_COOKIE['fbs_' . $GLOBALS['_fb_app']->id])) {
/**
- * Convenience method to get app info based on apikey or nid.
+ * Convenience method to get app info based on id or nid.
*/
function fb_get_app($search_data) {
// $search_data can be an apikey, or an array of other search params.
if (!is_array($search_data))
- $search_data = array('apikey' => $search_data);
+ $search_data = array('id' => $search_data);
$fb_app = fb_invoke(FB_OP_GET_APP, $search_data);
return $fb_app;
'%function' => $function,
'%op' => $op,
'%label' => $data['fb_app']->label,
- '%apikey' => $data['fb_app']->apikey,
+ '%id' => $data['fb_app']->id,
'!app' => l($data['fb_app']->label, FB_PATH_ADMIN_APPS . '/' . $data['fb_app']->label),
)));
}
global $_fb, $_fb_app;
$js_array = array();
- if (isset($_REQUEST['apikey'])) {
- $_fb_app = fb_get_app(array('apikey' => $_REQUEST['apikey']));
+ if (isset($_REQUEST['appId'])) {
+ $_fb_app = fb_get_app(array('id' => $_REQUEST['appId']));
if ($_fb_app) {
$_fb = fb_api_init($_fb_app);
// Data to pass to hook_fb.
}
else {
- watchdog('fb', 'fb_ajax_event did not find application %id', array('%id' => $_REQUEST['apikey']), WATCHDOG_ERROR);
+ watchdog('fb', 'fb_ajax_event did not find application %id', array('%id' => $_REQUEST['appId']), WATCHDOG_ERROR);
}
if ($event_type == 'session_change') {
}
else {
- watchdog('fb', 'fb_ajax_event called badly. Not passed apikey.', array(), WATCHDOG_ERROR);
+ watchdog('fb', 'fb_ajax_event called badly. Not passed app id.', array(), WATCHDOG_ERROR);
// Trying to track down what makes this happen.
if (fb_verbose() == 'extreme') {
- watchdog('fb', 'fb_ajax_event called badly. Not passed apikey. trace: !trace', array(
+ watchdog('fb', 'fb_ajax_event called badly. Not passed app id. trace: !trace', array(
'!trace' => '<pre>' . print_r(debug_backtrace(), 1) . '</pre>',
), WATCHDOG_ERROR);
}
// Defaults for new app.
$fb_app = (object) array(
'label' => NULL,
- 'apikey' => NULL,
+ 'apikey' => NULL, // deprecated.
'canvas' => NULL,
'fba_id' => NULL,
'id' => NULL,
<li>If building a Canvas Page App, specify a Canvas Path.</li>
<li>Upload icon and logo images. The icon appears in News Feed stories and the logo appears in the Connect dialog when the user connects with your site.</li>
<li>Click Submit.</li>
-<li>Copy the displayed API Key, Application Secret and App ID into this form.</li>
+<li>Copy the displayed App ID and Application Secret into this form.</li>
</ol>';
$form['helptext'] = array(
'#default_value' => $fb_app->id,
'#description' => t('Facebook will generate this value when you create the application.'),
);
- $form['apikey'] = array(
- '#type' => 'textfield',
- '#title' => t('API Key'),
- '#required' => TRUE,
- '#default_value' => $fb_app->apikey,
- '#description' => t('Facebook will generate this value when you create the application.'),
- );
$form['secret'] = array(
'#type' => 'textfield',
'#title' => t('Secret'),
fb_admin_get_app_properties($fb_app);
if (!$fb_app->application_name) {
// Don't use form_set_error(), as that will prevent the user from saving any data.
- drupal_set_message(t("Unable to get application properties. Possibly, you've given the wrong apikey or secret. Possibly, this server is unable to reach facebook's servers. Your application will not work properly!"), 'error');
+ drupal_set_message(t("Unable to get application properties. Possibly, you've given the wrong id or secret. Possibly, this server is unable to reach facebook's servers. Your application will not work properly!"), 'error');
$fb_app->application_name = 'UNKOWN';
}
}
->fields(array(
'label' => $fb_app->label,
'status' => $fb_app->status,
- 'apikey' => $fb_app->apikey,
+ 'apikey' => $fb_app->id, // Note, apikey deprecated. Using ID.
'secret' => $fb_app->secret,
'id' => $fb_app->id,
// Canvas and title are learned from facebook, not the form.
->fields(array(
'label' => $fb_app->label,
'status' => $fb_app->status,
- 'apikey' => $fb_app->apikey,
+ 'apikey' => $fb_app->id, // Note, apikey deprecated. Using ID.
'secret' => $fb_app->secret,
'id' => $fb_app->id,
// Canvas and title are learned from facebook, not the form.
))
->execute();
- watchdog('fb_app', 'Created Facebook Application %label.',
- array('%label' => $fb_app->label,
+ watchdog('fb_app', 'Created Facebook Application %label.', array(
+ '%label' => $fb_app->label,
),
WATCHDOG_NOTICE,
l(t('view apps'), FB_PATH_ADMIN_APPS));
- drupal_set_message(t('Created facebook application %title (%label).',
- array('%label' => $fb_app->label,
- '%title' => $fb_app->application_name)));
+ drupal_set_message(t('Created facebook application %title (%label).', array(
+ '%label' => $fb_app->label,
+ '%title' => $fb_app->application_name,
+ )));
}
catch (Exception $e) {
// Log the exception to watchdog.
->execute();
drupal_set_message(t("Changed fb application name from %label_old to %label_new. Please adjust any custom code or settings which rely on app's label.", array(
- '%label_old' => $label_old,
+ '%label_old' => $label_old,
'%label_new' => $label_new,
)), 'warning');
}
return $ret;
}
+
+
// We also support these ways to query an app. Columns in fb_app table.
foreach (array(
- 'fba_id' => ':fba_id',
- 'id' => ':id',
- 'apikey' => ':apikey',
- 'label' => ':label') as $key => $placeholder) {
+ 'fba_id' => ':fba_id',
+ 'id' => ':id',
+ 'apikey' => ':apikey', // deprecated
+ 'label' => ':label',
+ ) as $key => $placeholder) {
if (isset($data[$key])) {
$where[] = "$key = $placeholder";
$args[$placeholder] = $data[$key];
if (!$return && ($id = fb_settings(FB_SETTINGS_ID))) {
$return = fb_get_app(array('id' => $id));
}
- elseif (!$return && ($apikey = fb_settings(FB_SETTINGS_APIKEY))) {
+ elseif (!$return && ($apikey = fb_settings(FB_SETTINGS_APIKEY))) { // deprecated XXX
$return = fb_get_app(array('apikey' => $apikey));
}
}
$props_map = fb_invoke(FB_OP_LIST_PROPERTIES, array('fb_app' => $fb_app), array());
$data = array(
t('Label') => $fb_app->label,
- t('API Key') => $fb_app->apikey,
+ t('App ID') => $fb_app->id,
//t('Secret') => $fb_app->secret,
);
foreach ($props_map as $name => $key) {
function fb_connect_fb($op, $data, &$return) {
if ($op == FB_OP_CURRENT_APP && !$return && !fb_is_canvas()) {
// This will cause fb.module to set the global $_fb when user is logged in via fbConnect.
- if ($apikey = variable_get(FB_VAR_APIKEY, NULL)) {
+ if ($id = variable_get(FB_VAR_ID, NULL)) {
+ // Use $conf['fb_id'] if set in settings.php.
+ $return = fb_get_app(array('id' => $id));
+ }
+ elseif ($apikey = variable_get(FB_VAR_APIKEY, NULL)) { // Deprecated. Use fb_id instead.
// Use $conf['fb_apikey'] if set in settings.php.
$return = fb_get_app(array('apikey' => $apikey));
}
- // $conf['fb_apikey'] sanity check
+ // $conf['fb_apikey'] sanity check.
if ($apikey = variable_get(FB_VAR_APIKEY, NULL)) {
$fb_app = fb_get_app(array('apikey' => $apikey));
$message = t('Drupal for Facebook no longer uses the \'fb_apikey\' variable. Change $conf[\'fb_apikey\'] in your settings.php. Use $conf[\'fb_id\'] instead, and make the value the app id (%app_id) instead of the apikey.', array(
// Old url rewrite sanity check.
if ($id = fb_settings(FB_SETTINGS_CB)) {
- if ($GLOBALS['_fb_app']->apikey == $id) {
- $message = t('Facebook callback URLs have changed. They now include the app\'s ID, instead of APIKEY. Your application %label has not been updated. Either <a target=_top href=!sync_url>sync properties</a> or manually change callbacks on remote settings.', array(
- '%label' => $GLOBALS['_fb_app']->title,
- '!sync_url' => url(FB_PATH_ADMIN_APPS . '/' . $GLOBALS['_fb_app']->label . '/fb/set_props', array(
- 'fb_url_alter' => FALSE,
- )),
- ));
+ if ($GLOBALS['_fb_app']->id != $id && $GLOBALS['_fb_app']->apikey == $id) {
+ $message = 'Facebook callback URLs have changed. They now include the app\'s ID, instead of APIKEY. Your application %label has not been updated. Either <a target=_top href=!sync_url>sync properties</a> or manually change callbacks on remote settings.';
+ $args = array(
+ '%label' => $GLOBALS['_fb_app']->title,
+ '!sync_url' => url(FB_PATH_ADMIN_APPS . '/' . $GLOBALS['_fb_app']->label . '/fb/set_props', array(
+ 'fb_url_alter' => FALSE,
+ )),
+ );
if (user_access('access administration pages')) {
drupal_set_message(t($message, $args), 'warning');
}
/**
* Implements hook_fb_admin().
+ *
*/
function fb_tab_fb_admin($op, $data, &$return) {
$fb = isset($data['fb']) ? $data['fb'] : NULL;
$config = _fb_tab_get_config($fb_app);
if ($op == FB_ADMIN_OP_SET_PROPERTIES) {
$return['tab_default_name'] = $config['tab_default_name'];
- $return['profile_tab_url'] = $config['profile_tab_url'];
- //$return['edit_url'] = $config['edit_url']; // Apparently not used by facebook.
+
+ if ($config['profile_tab_url']) {
+ $return['profile_tab_url'] = url($config['profile_tab_url'], array(
+ 'absolute' => TRUE,
+ 'fb_canvas' => FALSE,
+ ));;
+ }
+ else {
+ $return['profile_tab_url'] = '';
+ }
+
+ if ($config['edit_url']) {
+ // http://forum.developers.facebook.net/viewtopic.php?id=88920
+ $return['edit_url'] = url($config['edit_url'], array(
+ 'absolute' => TRUE,
+ 'fb_canvas' => $fb_app->label, // @TODO make canvas optional
+ ));;
+ }
+ else {
+ $return['edit_url'] = '';
+ }
}
elseif ($op == FB_ADMIN_OP_LIST_PROPERTIES) {
$return[t('Profile Tab Name')] = 'tab_default_name';
'#default_value' => $config['profile_tab_url'],
'#description' => t('Recommended value is %tab_path. You may choose another if you have defined a custom menu item or view.', array('%tab_path' => FB_TAB_PATH_VIEW)),
);
- /* XXX is this used by facebook?
+
$form['fb_app_data']['fb_tab']['edit_url'] = array(
'#type' => 'textfield',
'#title' => 'Edit URL',
'#default_value' => $config['edit_url'],
'#description' => t('Recommended value is %edit_url.', array(
- '%edit_url' => url(FB_TAB_PATH_FORM, array('absolute'=> TRUE)))),
+ '%edit_url' => FB_TAB_PATH_FORM,
+ )),
);
- $form['fb_app_data']['fb_tab']['edit_url']['#description'] .= '<br/>' . t('Note that this field is apparently unused by facebook.');
- */
}
}
//require 'fb_canvas.admin.inc';
fb_tab_admin_form_alter($form, $form_state, $form_id);
}
-
- if (fb_is_tab()) {
- // Most Drupal forms have an action that assumes Drupal's base_path.
- // But in the case of FBML, we need to make it explicit.
- $form['#action'] = url(request_path(), array('absolute' => TRUE));
- //dpm(__FUNCTION__ . " changed action to " . $form['#action']);
- }
-}
-
-function _fb_tab_make_form_action_local($action = NULL) {
- global $base_path;
-
- if (!isset($action)) {
- // Is this ever reached?
- $action = request_path();
- }
-
- // If action is fully qualified, do not change it
- if (strpos($action, ':')) {
- return $action;
- }
-
- $relative = url('');
- $absolute = url('', array('absolute' => TRUE));
- $base_path = base_path(); // By default, '#action' will be request_uri(), which starts with base_path();
- global $_fb_app;
-
- if (strpos($action, $relative) === 0) {
- // If here, the action was made by call to url() and we prepended
- // canvas_name. Now remove the canvas name for a proper absolute url.
- // (Comment forms reach this clause but node forms do not.)
- $action = substr($action, strlen($relative));
- }
- elseif ($base_path && strpos($action, $base_path) === 0) {
- $action = substr($action, strlen($base_path));
- }
-
- $action = url(ltrim($action, '/'), array('absolute' => TRUE));
-
- return $action;
-
}
/**
'custom_theme' => NULL,
'tab_default_name' => isset($fb_app->title) ? $fb_app->title : NULL,
'profile_tab_url' => FB_TAB_PATH_VIEW,
+ 'edit_url' => FB_TAB_PATH_FORM,
);
return $config;
}