You are here

function _biblio_get_user_profile_form in Bibliography Module 7

Same name and namespace in other branches
  1. 5 biblio.module \_biblio_get_user_profile_form()
  2. 6.2 includes/biblio.admin.inc \_biblio_get_user_profile_form()
  3. 6 biblio.admin.inc \_biblio_get_user_profile_form()
  4. 7.2 includes/biblio.admin.inc \_biblio_get_user_profile_form()

This functin is used by both the admin/config/content/biblio page and user profile page

  • if $user is set, then it is being called from the user profile page.
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 1776
biblio.admin.inc

Code

function _biblio_get_user_profile_form($profile_user = FALSE) {
  $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) {
    $form += _biblio_drupal_author_user_map($profile_user, $allow_edit);
  }
  $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;
}