function _biblio_get_user_profile_form in Bibliography Module 7.2
Same name and namespace in other branches
- 5 biblio.module \_biblio_get_user_profile_form()
- 6.2 includes/biblio.admin.inc \_biblio_get_user_profile_form()
- 6 biblio.admin.inc \_biblio_get_user_profile_form()
- 7 includes/biblio.admin.inc \_biblio_get_user_profile_form()
2 calls to _biblio_get_user_profile_form()
- biblio_admin_settings in includes/
biblio.admin.inc - Implementation of hook_settings().
- biblio_form_user_profile_form_alter in ./
biblio.module - Implements hook_user().
File
- includes/
biblio.admin.inc, line 1558
Code
function _biblio_get_user_profile_form($profile_user = FALSE) {
global $user;
$form = array();
$allow_edit = variable_get('biblio_show_user_profile_form', '1');
$allow_edit = $allow_edit || user_access('administer biblio');
if (!$profile_user) {
$form['biblio_show_user_profile_form'] = array(
'#type' => 'checkbox',
'#title' => t('Allow users to override these settings on their "My account" page'),
'#return_value' => 1,
'#description' => t('If this is selected, a form similar to this section will be available to the user when they edit their own account information. This will allow them to override the global preferences set here.'),
'#default_value' => variable_get('biblio_show_user_profile_form', '1'),
);
}
$form['biblio_show_profile'] = array(
'#type' => 'checkbox',
'#title' => $profile_user ? t('Show my publications on my profile page') : t('Show publications on users profile pages'),
'#return_value' => 1,
'#disabled' => !$allow_edit,
'#description' => $profile_user ? t('Selecting this will create a listing of your publications on your profile page') : t('This sets the site wide default, users may change this in their profile'),
);
if ($profile_user) {
$form['biblio_show_profile']['#default_value'] = isset($profile_user->data['biblio_show_profile']) ? $profile_user->data['biblio_show_profile'] : variable_get('biblio_show_profile', '0');
}
else {
$form['biblio_show_profile']['#default_value'] = variable_get('biblio_show_profile', '0');
}
$form['#biblio_show_profile'] = $form['biblio_show_profile']['#default_value'];
$form['biblio_my_pubs_menu'] = array(
'#type' => 'checkbox',
'#title' => t('Show "My publications" item in the navigation menu'),
'#disabled' => !$allow_edit,
'#return_value' => 1,
'#description' => '',
);
if ($profile_user) {
$form['biblio_my_pubs_menu']['#default_value'] = isset($profile_user->data['biblio_my_pubs_menu']) ? $profile_user->data['biblio_my_pubs_menu'] : variable_get('biblio_my_pubs_menu', '0');
}
else {
$form['biblio_my_pubs_menu']['#default_value'] = variable_get('biblio_my_pubs_menu', '0');
}
$form['#biblio_my_pubs_menu'] = $form['biblio_my_pubs_menu']['#default_value'];
if ($profile_user) {
$db_result = db_query("SELECT cd.lastname, cd.firstname, cd.initials, cd.cid FROM {biblio_contributor_data} cd\n ORDER by cd.lastname ASC ");
$options = array();
$options[0] = t('(None)');
foreach ($db_result as $row) {
$options[$row->cid] = "{$row->lastname}, {$row->firstname} {$row->initials} ";
}
if (isset($profile_user->data['biblio_id_change_count']) && $profile_user->data['biblio_id_change_count'] > 2) {
$allow_edit = 0;
$msg = t('This control has been disabled because the author mapping has been changed more than 3 times, please see your system administrator to have it reset.');
}
else {
$msg = t('This will link your profile to the selected author from the biblio database, then all publications containing this author to be displayed on your "Publications" tab.');
}
$form['biblio_contributor_id'] = array(
'#type' => 'select',
'#title' => t('Link My Profile with this Author from the Biblio database'),
'#default_value' => isset($profile_user->data['biblio_contributor_id']) ? $profile_user->data['biblio_contributor_id'] : 0,
'#disabled' => $user->uid == 1 || user_access('administer biblio') ? FALSE : !$allow_edit,
'#options' => $options,
'#description' => $msg,
);
$form['biblio_id_change_count'] = array(
'#type' => 'textfield',
'#size' => 2,
'#title' => t('Drupal UserID to Biblio AuthorID mapping change count'),
'#default_value' => isset($profile_user->data['biblio_id_change_count']) ? $profile_user->data['biblio_id_change_count'] : 0,
'#disabled' => $user->uid == 1 || user_access('administer biblio') ? FALSE : TRUE,
'#description' => 'When this value is >= 3, the user will no longer be able to change their author id mapping',
);
$options = array();
$options['system'] = t('System default');
$options = array_merge($options, biblio_get_styles());
$form['biblio_user_style'] = array(
'#type' => 'select',
'#title' => t('Style'),
'#default_value' => isset($profile_user->data['biblio_user_style']) ? $profile_user->data['biblio_user_style'] : 'system',
'#options' => $options,
'#description' => t('Set the bibliographic style of the "list" view.'),
);
}
return $form;
}