function fbconnect_menu in Facebook Connect 5
Same name and namespace in other branches
- 8.2 fbconnect.module \fbconnect_menu()
- 6.2 fbconnect.module \fbconnect_menu()
- 6 fbconnect.module \fbconnect_menu()
- 7.2 fbconnect.module \fbconnect_menu()
Implementation of hook_menu().
File
- ./
fbconnect.module, line 18 - This module allows site visitors to connect and register with facebook account
Code
function fbconnect_menu($may_cache) {
global $user;
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/fbconnect',
'title' => 'Fbconnect',
'callback' => 'drupal_get_form',
'callback arguments' => array(
'fbconnect_admin_settings',
),
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'fbconnect/register/create',
'title' => t('Connect with Facebook'),
'callback' => 'fbconnect_register_page',
'access' => !$user->uid,
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'fbconnect/register/prompt',
'title' => t('Facebook Connect'),
'callback' => 'fbconnect_prompt_page',
'access' => !$user->uid,
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'fbconnect/invite/friends',
'title' => t('Share with my friends'),
'callback' => 'fbconnect_render_friends_invite_form',
'access' => $user->uid,
'type' => MENU_CALLBACK,
);
}
else {
// Renders the JS necessary for any Facebook interaction to work.
_fbconnect_render_js();
if (arg(0) == 'fbconnect' && arg(1) == 'register') {
$GLOBALS['conf']['cache'] = FALSE;
}
if (arg(0) == 'user' && is_numeric(arg(1))) {
$account = user_load(array(
'uid' => arg(1),
));
if ($account->uid) {
$access = user_access('administer users') || $user->uid == arg(1);
$items[] = array(
'path' => 'user/' . arg(1) . '/fbconnect',
'title' => check_plain($account->name),
'callback' => 'fbconnect_user_identities',
'callback arguments' => array(
$account,
),
'access' => $access,
'type' => MENU_LOCAL_TASK,
);
}
}
}
return $items;
}