function _biblio_drupal_author_user_map in Bibliography Module 7
2 calls to _biblio_drupal_author_user_map()
- biblio_form_user_profile_form_alter in ./
biblio.module - Implements hook_user().
- _biblio_get_user_profile_form in includes/
biblio.admin.inc - This functin is used by both the admin/config/content/biblio page and user profile page
File
- includes/
biblio.admin.inc, line 1840 - biblio.admin.inc
Code
function _biblio_drupal_author_user_map($profile_user, $allow_edit = TRUE) {
global $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, you will no longer be able to change your author id mapping. Contact your system administrator to reset this value.',
);
return $form;
}