function fb_user_post_add_cb in Drupal for Facebook 5
The post-add page is where the user is sent after adding the application.
Note that the Facebook App settings must be set up. See "post-add" callback. To customize this behavior, use form_alter to modify the default form, or create your own callback.
Special case when $_REQUEST['redirect'] is set. In this case we've come after a request from our sync callback (or any call to $fb->require_add) and we're going to cache some data so it can be used on the other end.
1 string reference to 'fb_user_post_add_cb'
File
- ./
fb_user.module, line 91 - 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_post_add_cb() {
global $fb, $fb_app, $user;
if (fb_verbose()) {
watchdog('fb_debug', "New user has added an app, post-add callback called.");
if (function_exists('dprint_r')) {
watchdog('fb_debug', "New user has added an app." . dprint_r($_REQUEST, 1));
}
}
// Check that actually need to render this page.
fb_user_post_add_check();
// Will exit() if user has been redirected.
// redirect was not passed in, present form(s) prompting the user to
// decide what to do next.
$weight = 0;
// Although user has just added the app, they may have an authmap entry
// already. This happens if they have installed then removed the app, or
// they've added another app on this same server. In this case, we don't
// want to display the login form.
if (!$user->uid) {
//watchdog('debug', 'fb_user_post_add_cb' . dprint_r($_REQUEST, 1));
$output['login'] = array(
'#type' => 'fieldset',
'#title' => t('Login to !site account', array(
'!site' => variable_get('site_name', 'Drupal'),
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => $weight++,
);
$output['login']['form'] = array(
'#value' => drupal_get_form('user_login'),
);
$output['register'] = array(
'#type' => 'fieldset',
'#title' => t('Register new account', array(
'!site' => variable_get('site_name', 'Drupal'),
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#weight' => $weight++,
);
$output['register']['form'] = array(
'#value' => drupal_get_form('user_register'),
);
}
$output['skip'] = array(
'#value' => l(t('Skip registration, use !app', array(
'!app' => t($fb_app->title),
)), '<front>', array(
'class' => 'fb_button',
)),
'#weight' => $weight++,
'#prefix' => '<p>',
'#suffix' => '</p>',
);
// TODO: make output customizable by third-party modules.
return drupal_render($output);
}