You are here

function user_relationships_admin_settings in User Relationships 7

Main settings

2 string references to 'user_relationships_admin_settings'
user_relationships_menu in ./user_relationships.module
Implements hook_menu().
user_relationship_elaborations_form_alter in user_relationship_elaborations/user_relationship_elaborations.module
hook_form_alter() to catch the approval form

File

./user_relationships.admin.inc, line 11
User Relationships admin settings and config forms

Code

function user_relationships_admin_settings() {
  $form['settings'] = array(
    '#type' => 'vertical_tabs',
  );
  $form['general'] = array(
    '#type' => 'fieldset',
    '#title' => t('General'),
    '#weight' => -10,
    '#group' => 'settings',
  );
  $form['general']['user_relationships_allow_multiple'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow multiple relationships'),
    '#description' => t('If checked, a user may create multiple relationships (each relationship of a different type) with another user.'),
    '#default_value' => variable_get('user_relationships_allow_multiple', 1),
  );
  $form['general']['user_relationships_show_direct_links'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show a separate link per relationship type'),
    '#description' => t("On a user's page, show a separate link for each available relationship type (instead of the generic 'Create a relationship' link)."),
    '#default_value' => variable_get('user_relationships_show_direct_links', 1),
  );
  $form['general']['user_relationships_show_user_pictures'] = array(
    '#type' => 'checkbox',
    '#title' => t("Show user pictures on relationship pages"),
    '#description' => t("Show a picture next to each user's name on 'My relationships' pages."),
    '#default_value' => variable_get('user_relationships_show_user_pictures', 0),
  );
  $form['general']['user_relationships_allow_auto_approve'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow users to auto approve'),
    '#description' => t('Provide users with an option to automatically approve all requested relationships.'),
    '#default_value' => variable_get('user_relationships_allow_auto_approve', 0),
  );
  $form['general']['user_relationships_relationships_per_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Relationships per page'),
    '#size' => 4,
    '#description' => t('Number of relationships to show per page. If set to 0 all will be shown.'),
    '#default_value' => variable_get('user_relationships_relationships_per_page', 16),
    '#validate' => array(
      'user_relationships_setting_validation' => array(
        array(
          'is_numeric' => array(
            'msg' => t('The relationships per page setting is not an integer'),
          ),
        ),
      ),
    ),
  );
  $form['positioning'] = array(
    '#type' => 'fieldset',
    '#title' => t('AJAX Popup Positioning'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Some themes may require repositioning of AJAX confirmation dialogs. You may use these controls to set where the popup appears on the page or in relation to the mouse cursor.'),
    '#group' => 'settings',
  );
  $form['positioning']['user_relationships_enable_ajax_popups'] = array(
    '#type' => 'checkbox',
    '#title' => t('Show AJAX confirmation popups'),
    '#default_value' => variable_get('user_relationships_enable_ajax_popups', 0),
    '#description' => t('Other popup settings below will only take effect if popups are enabled.'),
  );
  $form['positioning']['user_relationships_position'] = array(
    '#type' => 'select',
    '#title' => t("Elaboration form's css position"),
    '#default_value' => variable_get('user_relationships_position', 'absolute'),
    '#options' => array(
      'absolute' => t('Mouse cursor'),
      'fixed' => t('Fixed'),
    ),
    '#description' => t('Sets the css <em>position</em> property of AJAX confirmation popups.'),
  );
  $form['positioning']['user_relationships_left'] = array(
    '#type' => 'textfield',
    '#title' => t("Elaboration form's css left value"),
    '#default_value' => variable_get('user_relationships_left', '0'),
    '#size' => 4,
    '#description' => t("Sets the css <em>left</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.5 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
  );
  $form['positioning']['user_relationships_top'] = array(
    '#type' => 'textfield',
    '#title' => t("Elaboration form's css top value"),
    '#default_value' => variable_get('user_relationships_top', '0'),
    '#size' => 4,
    '#description' => t("Sets the css <em>top</em> property of AJAX confirmation popups. Try the value of 0 for 'Mouse cursor', or 0.4 for 'Fixed'. You may enter a distance in pixels, or as a % using a value 1 or less. Relative positioning requires a fixed position."),
  );
  $form['messages'] = array(
    '#type' => 'fieldset',
    '#title' => t('Custom Screen Messages'),
    '#weight' => 0,
    '#description' => t('Customize the confirmation messages displayed to users when specific relationship events occur.'),
    '#group' => 'settings',
  );
  $form['messages']['user_relationships_requests_link'] = array(
    '#type' => 'textfield',
    '#title' => t('Path to relationship requests'),
    '#default_value' => variable_get('user_relationships_requests_link', 'relationships/received'),
    '#description' => t("Only change this setting if a user's pending relationship requests have a different location than the default path (relationships/received)"),
  );
  $form['messages']['messages_settings'] = array(
    '#type' => 'vertical_tabs',
  );
  $default_messages = _user_relationships_default_messages(array());
  _user_relationships_message_settings_form($form['messages'], $default_messages);

  //options for author pane integration
  if (function_exists('author_pane_api') && author_pane_api() == '2') {
    $rtypes = user_relationships_types_load();
    $form['author_pane'] = array(
      '#type' => 'fieldset',
      '#title' => t('Author Pane'),
      '#collapsible' => TRUE,
      '#group' => 'settings',
    );
    $form['author_pane']['user_relationships_enable_author_pane'] = array(
      '#type' => 'checkbox',
      '#title' => t('Show links in Author Pane'),
      '#description' => t('Check if you wish to show add/remove relationship links in Author Pane.'),
      '#default_value' => variable_get('user_relationships_enable_author_pane', 0),
    );

    // Since AP supports only one link per module, need to pick one relationship type
    if (count($rtypes)) {
      $options = array();
      foreach ($rtypes as $rtype) {
        $options[$rtype->rtid] = $rtype->name;
      }
      $form['author_pane']['user_relationships_author_pane_rtids'] = array(
        '#type' => 'select',
        '#multiple' => TRUE,
        '#title' => t('Relationship types to use'),
        '#default_value' => variable_get('user_relationships_author_pane_rtids', 'absolute'),
        '#options' => $options,
        '#description' => t('The chosen relationship types will be used for add/remove links.'),
      );
    }
  }
  return system_settings_form($form);
}