You are here

function _prod_check_user_register in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 prod_check.module \_prod_check_user_register()

File

./prod_check.module, line 683

Code

function _prod_check_user_register($caller = 'internal') {
  $check = array();
  $title = 'User registration';
  $setting[0] = t('Only site administrators can create new user accounts');
  $setting[1] = t('Visitors can create accounts and no administrator approval is required');
  $setting[2] = t('Visitors can create accounts but administrator approval is required');
  $path = 'admin/user/settings';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $current = variable_get('user_register', 1);
  $check['prod_check_user_register'] = array(
    '#title' => t($title),
    '#state' => $current != 1,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
    '#value_ok' => $setting[$current],
    '#value_nok' => $setting[1],
    '#description_ok' => prod_check_ok_title($title, $path),
    '#description_nok' => t('Your !link settings are set to %setting1. Are you sure this is what you want and did not mean to use %setting2? With improperly setup access rights, this can be dangerous...', array(
      '!link' => '<em>' . l(t($title), $path, array(
        'attributes' => array(
          'title' => t($title),
        ),
        'query' => drupal_get_destination(),
      )) . '</em>',
      '%setting1' => $setting[$current],
      '%setting2' => $setting[2],
    )),
    '#nagios_key' => 'USR',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}