function biblio_user in Bibliography Module 6.2
Same name and namespace in other branches
- 5 biblio.module \biblio_user()
- 6 biblio.module \biblio_user()
Implements hook_user().
File
- ./
biblio.module, line 616 - Main file for Drupal module biblio.
Code
function biblio_user($type, &$edit, &$account, $category = NULL) {
global $user;
if ($type == 'form' && $category == 'account') {
$form = array();
module_load_include('inc', 'biblio', 'includes/biblio.admin');
$show_form = variable_get('biblio_show_user_profile_form', '1') || variable_get('biblio_show_crossref_profile_form', '1') || variable_get('biblio_show_openurl_profile_form', '1');
$admin_show_form = $user->uid == 1 || user_access('administer users') && user_access('administer biblio') ? TRUE : FALSE;
if ($admin_show_form || $show_form) {
$form['biblio_fieldset'] = array(
'#type' => 'fieldset',
'#title' => t('Biblio settings'),
'#weight' => 5,
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
if ($admin_show_form || variable_get('biblio_show_user_profile_form', '1')) {
_biblio_get_user_profile_form($form['biblio_fieldset'], $account);
}
if ($admin_show_form || variable_get('biblio_show_openurl_profile_form', '1')) {
_biblio_get_user_openurl_form($form['biblio_fieldset'], $account);
}
if ($admin_show_form || variable_get('biblio_show_crossref_profile_form', '1')) {
_biblio_get_user_doi_form($form['biblio_fieldset'], $account);
}
}
return $form;
}
if ($type == 'validate' && $category == 'account') {
// TODO: this is not reached at all
if (($edit['biblio_my_pubs_menu'] || $edit['biblio_show_profile']) && $edit['biblio_contributor_id'] == 0) {
$message = t('You did not supply an associated biblio author.');
drupal_set_message($message, 'warning');
}
}
if ($type == 'after_update' && $category == 'account') {
//TODO: detect if a biblio setting was changed before invoking menu_rebuild
// menu_rebuild();
}
if ($type == 'update' && $category == 'account') {
if (isset($edit['biblio_contributor_id'])) {
db_query("UPDATE {biblio_contributor_data} SET drupal_uid = 0 WHERE drupal_uid = %d", $account->uid);
db_query('UPDATE {biblio_contributor_data} SET drupal_uid = %d WHERE cid = %d ', $account->uid, $edit['biblio_contributor_id']);
}
}
if ($type == 'categories') {
// return array(array('name' => 'account', 'title' => t('Account settings'), 'weight' => 1));
}
}