You are here

function biblio_form_user_profile_form_alter in Bibliography Module 7

Same name and namespace in other branches
  1. 7.2 biblio.module \biblio_form_user_profile_form_alter()

Implements hook_user().

File

./biblio.module, line 583
Bibliography Module for Drupal.

Code

function biblio_form_user_profile_form_alter(&$form, &$form_state, $form_id) {
  if ($form['#user_category'] == 'account') {
    $account = $form['#user'];
    include_once drupal_get_path('module', 'biblio') . '/includes/biblio.admin.inc';
    $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 = $account->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' => FALSE,
      );
      if ($admin_show_form || variable_get('biblio_show_user_profile_form', '1')) {
        $form['biblio_fieldset'] += _biblio_get_user_profile_form($account);
      }
      else {
        $form['biblio_fieldset'] += _biblio_drupal_author_user_map($account);
      }
      if ($admin_show_form || variable_get('biblio_show_openurl_profile_form', '1')) {
        $form['biblio_fieldset'] += _biblio_get_user_openurl_form($account);
      }
      if ($admin_show_form || variable_get('biblio_show_crossref_profile_form', '1')) {
        $form['biblio_fieldset'] += _biblio_get_user_doi_form($account);
      }
    }
  }
}