function fb_user_admin_settings in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 fb_user.admin.inc \fb_user_admin_settings()
- 6.2 fb_user.admin.inc \fb_user_admin_settings()
- 7.4 fb_user.admin.inc \fb_user_admin_settings()
Form builder; Configure settings for this site.
See also
1 string reference to 'fb_user_admin_settings'
- fb_user_menu in ./
fb_user.module - Implements hook_menu().
File
- ./
fb_user.admin.inc, line 17 - Admin pages and forms for user settings.
Code
function fb_user_admin_settings() {
$options = array(
0 => t('<none>'),
) + fb_admin_get_app_options(FALSE);
if (count($options) == 1) {
$message = t('You must create an app first!');
drupal_set_message($message, 'error');
return array(
'help' => array(
'#markup' => $message,
),
);
}
$form[FB_USER_VAR_CHECK_SESSION] = array(
'#type' => 'checkbox',
'#title' => t('Validate session'),
'#description' => t('Before creating a user or mapping an account, verify the connection by calling into facebook. This adds overhead, requiring server-side request to facebook.com. The result is stored in local session, so should only happen when user first connects. A "signed request" is difficult to spoof, so this check may not be necessary.'),
'#default_value' => variable_get(FB_USER_VAR_CHECK_SESSION, NULL),
);
// Name options for automatically created user accounts.
$default = variable_get(FB_USER_VAR_USERNAME_STYLE, FB_USER_OPTION_USERNAME_FBU);
$form[FB_USER_VAR_USERNAME_STYLE] = array(
'#type' => 'radios',
'#title' => t('Username Style for Automatically Created Accounts'),
'#description' => t('Machine-friendly names include Facebook user ids to ensure uniqueness. Thanks to Drupal\'s theme layer, visitors to your site will <em>usually</em> see a proper name.<br/>Human-friendly names are like "John Smith". Because Drupal requires unique names, you may see "John Smith_2", "John Smith_3" and so on.'),
'#options' => array(
FB_USER_OPTION_USERNAME_FBU => t('Machine-friendly, i.e. "1234565789@facebook"'),
FB_USER_OPTION_USERNAME_FULL => t('Human-friendly, i.e. "John Smith"'),
),
'#default_value' => $default,
);
$form['fb_user_alter'] = array(
'#type' => 'fieldset',
'#title' => t('Form alters'),
'#description' => t('Add connect button to forms. If user has connected, show the user\'s name and profile picture.'),
);
$form['fb_user_alter']['registration'] = array(
'#type' => 'fieldset',
'#title' => t('Registration page'),
);
$form['fb_user_alter']['registration'][FB_USER_VAR_ALTER_REGISTER] = array(
'#type' => 'checkbox',
'#title' => t('Do alter registration form'),
'#default_value' => variable_get(FB_USER_VAR_ALTER_REGISTER, TRUE),
);
$form['fb_user_alter']['registration'][FB_USER_VAR_TEXT_REGISTER] = array(
'#type' => 'textfield',
'#title' => t('Registration form button text'),
'#size' => 60,
'#default_value' => _fb_user_button_text('user_register_form'),
'#description' => t('Leave blank for facebook\'s default image, "Connect".'),
);
$form['fb_user_alter']['login'] = array(
'#type' => 'fieldset',
'#title' => t('Login page'),
);
$form['fb_user_alter']['login'][FB_USER_VAR_ALTER_LOGIN] = array(
'#type' => 'checkbox',
'#title' => t('Do alter login form'),
'#default_value' => variable_get(FB_USER_VAR_ALTER_LOGIN, TRUE),
);
$form['fb_user_alter']['login'][FB_USER_VAR_TEXT_LOGIN] = array(
'#type' => 'textfield',
'#title' => t('Login form button text'),
'#size' => 60,
'#default_value' => _fb_user_button_text('user_login'),
);
$form['fb_user_alter']['login_block'] = array(
'#type' => 'fieldset',
'#title' => t('Login block'),
);
$form['fb_user_alter']['login_block'][FB_USER_VAR_ALTER_LOGIN_BLOCK] = array(
'#type' => 'checkbox',
'#title' => t('Do alter login block'),
'#default_value' => variable_get(FB_USER_VAR_ALTER_LOGIN_BLOCK, TRUE),
);
$form['fb_user_alter']['login_block'][FB_USER_VAR_TEXT_LOGIN_BLOCK] = array(
'#type' => 'textfield',
'#title' => t('Login block button text'),
'#size' => 60,
'#default_value' => _fb_user_button_text('user_login_block'),
);
$form['fb_user_alter'][FB_USER_VAR_ALTER_CONTACT] = array(
'#type' => 'checkbox',
'#title' => t('Do alter contact form'),
'#default_value' => variable_get(FB_USER_VAR_ALTER_CONTACT, TRUE),
'#description' => t('Sets name and email (if available) from facebook.'),
);
return system_settings_form($form);
}