You are here

function privatemsg_configure in Privatemsg 5

Same name and namespace in other branches
  1. 5.3 privatemsg.module \privatemsg_configure()
1 string reference to 'privatemsg_configure'
privatemsg_menu in ./privatemsg.module
Implementation of hook_menu().

File

./privatemsg.module, line 532

Code

function privatemsg_configure() {
  $form['privatemsg_max_rate'] = array(
    '#type' => 'select',
    '#title' => t('Private messaging max rate'),
    '#default_value' => variable_get('privatemsg_max_rate', 15),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      15,
      20,
      30,
      60,
    ), 'format_interval'),
    '#description' => t('Max submit rate for private messaging. To prevent abuse.'),
  );
  $form['privatemsg_sent_status'] = array(
    '#type' => 'select',
    '#title' => t('Sent message status'),
    '#default_value' => variable_get('privatemsg_sent_status', 1),
    '#options' => array(
      t('Disabled'),
      t('Enabled'),
    ),
    '#description' => t('If enabled users can see whether a message has been read or not.'),
  );
  $form['privatemsg_per_page'] = array(
    '#type' => 'select',
    '#title' => t('Messages per page'),
    '#default_value' => variable_get('privatemsg_per_page', 10),
    '#options' => drupal_map_assoc(array(
      5,
      10,
      15,
      20,
      25,
      30,
      35,
      40,
      50,
      60,
      80,
      100,
    )),
    '#description' => t('The maximum number of messages displayed per page; links to browse messages automatically appear.'),
  );
  $form['privatemsg_online_status'] = array(
    '#type' => 'select',
    '#title' => t('Show Online Status'),
    '#default_value' => variable_get('privatemsg_online_status', 1),
    '#options' => array(
      'No',
      'Yes',
    ),
    '#description' => t('Whether to allow users to see if message author was recently online'),
  );

  // use imagecache preset and only show if presets are available
  if (module_exists('imagecache') && is_array($privatemsg_presets = imagecache_presets())) {
    $privatemsg_presetselect = array(
      0 => t('Select ImageCache Preset'),
    );
    foreach ($privatemsg_presets as $privatemsg_p) {
      $privatemsg_presetselect[$privatemsg_p['presetname']] = $privatemsg_p['presetname'];
    }
    $form['privatemsg_imagecache_preset'] = array(
      '#type' => 'select',
      '#options' => $privatemsg_presetselect,
      '#title' => t('Choose Imagecache Preset for Displaying Avatars in Message Queue'),
      '#default_value' => variable_get('privatemsg_imagecache_preset', 0),
      '#description' => t('In the list of private messages, what imagecache preset should be used to resize the avatar images.'),
    );
  }
  $form['privatemsg_menu_link'] = array(
    '#type' => 'textfield',
    '#title' => t('Menu link'),
    '#default_value' => variable_get('privatemsg_menu_link', t('My inbox')),
    '#description' => t("Text shown in link to user's inbox."),
  );
  $options = array(
    '1' => t('Above the message'),
    '2' => t('Below the message'),
    '3' => t('Above and below the message'),
    '4' => t('Neither (show the old links)'),
  );
  $form['privatemsg_view_actions'] = array(
    '#type' => 'radios',
    '#title' => t('Display action form on view screens'),
    '#description' => t('Choose where to display the actions form on the view message screen.'),
    '#options' => $options,
    '#default_value' => variable_get('privatemsg_view_actions', '3'),
  );
  $options = array(
    '1' => t('Before other buttons'),
    '2' => t('After other buttons'),
  );
  $form['privatemsg_actions_loc'] = array(
    '#type' => 'radios',
    '#title' => t('Display delete button'),
    '#description' => t('Choose where to display the actions select on the folder view.'),
    '#options' => $options,
    '#default_value' => variable_get('privatemsg_actions_loc', '1'),
  );
  $form['privatemsg_threaded_view'] = array(
    '#type' => 'radios',
    '#title' => t('How messages are displayed on the detail screen'),
    '#description' => t('You can choose between displaying a thread of messages (like for example on facebook) or just a single message.'),
    '#options' => array(
      t('Single message'),
      t('Full thread'),
    ),
    '#default_value' => variable_get('privatemsg_threaded_view', 0),
  );
  $form['links'] = array(
    '#type' => 'fieldset',
    '#title' => t('"Write to author" links'),
    '#description' => t('Edit <a href="!settings-url">content types</a> to select where these links are displayed.', array(
      '!settings-url' => url('admin/content/types'),
    )),
  );
  $form['welcome'] = array(
    '#type' => 'fieldset',
    '#title' => t('Welcome message for new users'),
  );
  $form['welcome']['privatemsg_welcome_subject'] = array(
    '#type' => 'textfield',
    '#title' => t('Subject'),
    '#default_value' => variable_get('privatemsg_welcome_subject', t('Welcome')),
    '#size' => 50,
    '#maxlength' => 64,
  );
  $form['welcome']['privatemsg_welcome_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message'),
    '#default_value' => variable_get('privatemsg_welcome_message', ''),
    '#cols' => 80,
    '#rows' => 5,
    '#description' => t('Leave blank to disable this feature.'),
  );
  $form['welcome']['filterform'] = filter_form(variable_get('privatemsg_welcome_format', FILTER_FORMAT_DEFAULT));
  $sender = user_load(array(
    'uid' => variable_get('privatemsg_welcome_sender', 1),
  ));
  $form['welcome']['privatemsg_welcome_sender'] = array(
    '#type' => 'textfield',
    '#title' => t('Sender'),
    '#default_value' => $sender->name,
    '#autocomplete_path' => 'privatemsg/autocomplete',
    '#size' => 50,
    '#maxlength' => 64,
    '#required' => TRUE,
  );
  $form['admin_default'] = array(
    '#type' => 'fieldset',
    '#title' => t('Default user settings'),
    '#description' => 'Set the default values for user settings. These can be changed by each user.',
    '#collapsible' => TRUE,
  );
  $form['admin_default']['privatemsg_default_allow'] = array(
    '#type' => 'checkbox',
    '#title' => t("'Allow private messages' default"),
    '#default_value' => variable_get('privatemsg_default_allow', 1),
    '#description' => t("Check this box to set the default value of the 'Allow private messages' user setting."),
  );
  $form['admin_default']['privatemsg_default_setmessage_notify'] = array(
    '#type' => 'checkbox',
    '#title' => t("'Aggressive notification of new messages' default"),
    '#default_value' => variable_get('privatemsg_default_setmessage_notify', 1),
    '#description' => t("Check this box to set the default value of the 'Aggressive notification of new messages' user setting."),
  );
  return system_settings_form($form);
}