You are here

function _prod_check_user_register in Production check & Production monitor 7

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

File

./prod_check.module, line 709

Code

function _prod_check_user_register($caller = 'internal') {
  $check = array();
  $title = 'Account settings';
  $path = 'admin/config/people/accounts';
  if ($caller != 'internal') {
    $path = PRODCHECK_BASEURL . $path;
  }
  $setting[USER_REGISTER_ADMINISTRATORS_ONLY] = t('Administrators only');
  $setting[USER_REGISTER_VISITORS] = t('Visitors');
  $setting[USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL] = t('Visitors, but administrator approval is required');
  $current = variable_get('user_register', 1);
  $check['prod_check_user_register'] = array(
    '#title' => t($title),
    '#state' => $current != USER_REGISTER_VISITORS,
    '#severity' => $caller == 'nagios' ? NAGIOS_STATUS_WARNING : PROD_CHECK_REQUIREMENT_WARNING,
    '#value_ok' => $setting[$current],
    '#value_nok' => $setting[USER_REGISTER_VISITORS],
    '#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[USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL],
    )),
    '#nagios_key' => 'USR',
    '#nagios_type' => 'state',
  );
  return prod_check_execute_check($check, $caller);
}