You are here

function realname_admin_general in Real Name 6

2 string references to 'realname_admin_general'
realname_admin_settings in ./realname.admin.inc
Displays the admin settings form. @TODO: move this admin stuff to separate file.
realname_menu in ./realname.module
Implements hook_menu().

File

./realname.admin.inc, line 18
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function realname_admin_general() {
  $form = array();
  $form['realname_nodeapi'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Show realname in nodes') . '</strong>',
    '#description' => t('If this option is selected, the "Real name" will be used on node displays.'),
    '#default_value' => variable_get('realname_nodeapi', FALSE),
  );
  if (variable_get('realname_profile_module', NULL) == 'content_profile') {
    $form['realname_use_title'] = array(
      '#type' => 'checkbox',
      '#title' => '<strong>' . t('Add node title to available fields') . '</strong>',
      '#description' => t('This option allows you to include the profile title in the list of available fields.'),
      '#default_value' => variable_get('realname_use_title', FALSE),
    );
  }
  else {
    $form['realname_use_title'] = array(
      '#type' => 'value',
      '#value' => FALSE,
    );
  }
  if (module_exists('views')) {
    $form['realname_view'] = array(
      '#type' => 'checkbox',
      '#title' => '<strong>' . t('Overwrite user fields in view to show realnames') . '</strong>',
      '#description' => t('This option will overwrite the default user name definition in Views in order to show Realnames without the need to modify Views. Remember to rebuild your Views cache if you change this option.'),
      '#default_value' => variable_get('realname_view', FALSE),
    );
  }
  $form['realname_myacct'] = array(
    '#type' => 'textfield',
    '#title' => '<strong>' . t('Title for own account') . '</strong>',
    '#description' => t('This will be shown instead of "My account" on the user\'s own account pages and in the menu. If it is empty, the user\'s RealName will be shown.'),
    '#default_value' => variable_get('realname_myacct', t('My account')),
  );
  $form['search'] = array(
    '#type' => 'fieldset',
    '#title' => t('Search options'),
    '#description' => t('These settings control how RealName search will work.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $search_enable = variable_get('realname_search_enable', FALSE);
  $user_disable = variable_get('realname_user_disable', FALSE);
  $form['original_search_enable'] = array(
    '#type' => 'value',
    '#value' => $search_enable,
  );
  $form['original_user_disable'] = array(
    '#type' => 'value',
    '#value' => $user_disable,
  );
  $form['search']['realname_search_enable'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Enable realname search') . '</strong>',
    '#description' => t('If this option is selected, the "Real name" searching will be allowed. The menus will be rebuilt if this setting changes.'),
    '#default_value' => $search_enable,
  );
  $form['search']['realname_user_disable'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Disable user search') . '</strong>',
    '#description' => t('If this option is selected, the standard "Users" search page will be disabled. The menus will be rebuilt if this setting changes.'),
    '#default_value' => $user_disable,
  );
  $form['search']['realname_search_login'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Include login name in search') . '</strong>',
    '#description' => t('Should the "Real name" search also index the login name?'),
    '#default_value' => variable_get('realname_search_login', FALSE),
  );
  $form['theme'] = array(
    '#type' => 'fieldset',
    '#title' => t('Theme_username options'),
    '#description' => t('These settings control how "theme(\'username\', ...)" will work.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['theme']['realname_theme'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Override username theme') . '</strong>',
    '#description' => t('If this option is selected, the standard username theme function will be overriden to use the "Real name."'),
    '#default_value' => variable_get('realname_theme', TRUE),
  );
  $form['theme']['realname_max_username'] = array(
    '#type' => 'textfield',
    '#field_prefix' => '<strong>' . t('Maximum allowed username length') . '</strong> ',
    '#description' => t('Long usernames may "break" some tables or other displays; this setting limits the maximum length. Note that the core recommendation is 20.'),
    '#size' => 6,
    '#default_value' => variable_get('realname_max_username', 20),
  );
  $form['theme']['realname_notver'] = array(
    '#type' => 'checkbox',
    '#title' => '<strong>' . t('Show "Not verified" for anonymous users') . '</strong>',
    '#description' => t('Drupal core adds "Not verified" for anonymous users, this option allows that to be turned off.'),
    '#default_value' => variable_get('realname_notver', TRUE),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save configuration'),
  );
  return $form;
}