You are here

function errorlevelpermission_init in Error Level Permission 7

Implements hook_init().

File

./errorlevelpermission.module, line 23
errorlevelpermission.module

Code

function errorlevelpermission_init() {
  global $conf;

  // Care that no errors are shown before we take control.
  if (!empty($conf['error_level'])) {
    variable_set('error_level', ERROR_REPORTING_HIDE);
  }

  // Take over control.
  $level = user_access('errorlevelpermission show all') ? ERROR_REPORTING_DISPLAY_ALL : (user_access('errorlevelpermission show errors') ? ERROR_REPORTING_DISPLAY_SOME : ERROR_REPORTING_HIDE);

  // No need to waste DB writes via variable_set().
  $conf['error_level'] = $level;
}