You are here

function statistics_advanced_form_alter in Statistics Advanced 5

Implementation of hook_form_alter().

File

./statistics_advanced.module, line 11

Code

function statistics_advanced_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'statistics_access_logging_settings') {

    // Add advanced settings
    $form['content']['statistics_advanced_ignore_repeat_views'] = array(
      '#type' => 'checkbox',
      '#title' => t('Only allow unique content views to increase a content\'s view count.'),
      '#default_value' => variable_get('statistics_advanced_ignore_repeat_views', 1),
      '#description' => t('Requires "count content views" enabled above. Checking for repeat anonymous visits requires the "enable access log" above.'),
    );
    $form['access']['statistics_advanced']['statistics_advanced_ignore_user_roles'] = array(
      '#type' => 'checkboxes',
      '#title' => t('Do not record entries in the access log for users with the selected permissions'),
      '#description' => t('Requires "enable access log" enabled above. If you have certain users that perform extensive work on your site, this will help keep your accesslog table a little more clean and perform better. If you only want to exclude user #1, create a new role with no permissions and assign it to user #1. When enabled, this setting will also delete any records in the access log from users with the roles selected.'),
      '#options' => array_slice(user_roles(TRUE), 1, NULL, TRUE),
      '#default_value' => variable_get('statistics_advanced_ignore_user_roles', array()),
    );

    //array_splice($form, array_search('buttons', array_keys($form)), 0, $elements);
    $form['array_filter'] = array(
      '#type' => 'value',
      '#value' => TRUE,
    );
    $form['#submit'][] = 'statistics_advanced_form_submit';
  }
}