Index: customerror.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/customerror/customerror.module,v retrieving revision 1.17.2.10 diff -u -d -r1.17.2.10 customerror.module --- customerror.module 29 Mar 2010 16:11:09 -0000 1.17.2.10 +++ customerror.module 30 Apr 2010 05:37:04 -0000 @@ -63,13 +63,31 @@ ); $errors = _customerror_enum_errors(); + foreach($errors as $code => $desc) { - if (variable_get('site_' . $code, '') != 'customerror/' . $code) { - drupal_set_message(t('Error reporting is not set for error !error. Please check the settings !link.', array('!error' => $code, '!link' => l(t('here'), 'admin/settings/error-reporting'))), 'error'); - } + + // As an alternative to the standard nowarning patch file, you can apply + // this change to make the warning/error/notice/thingy more usefulish. + // Get the variables in advance, so we can restrict display of the warning + // to when there is actually some kind of custom error to be displayed. + $title = variable_get('customerror_' . $code . '_title', $desc); + $message = variable_get('customerror_' . $code, $desc); + $use_php = variable_get('customerror_' . $code . '_php', FALSE); + $existing = variable_get('site_' . $code, ''); + if ($existing != 'customerror/' . $code and ($title or $message or $use_php)) { + drupal_set_message( + t( + 'Error reporting for error !error is currently set to "!existing".
To use the CustomError settings for this error, you should change that to "!custom" on the !link.' + , array( + '!error' => $code, + '!existing' => $existing, + '!custom' => 'customerror/'.$code, + '!link' => l(t('Error reporting settings page'), 'admin/settings/error-reporting')) + ) + , 'warning' + ); } - foreach($errors as $code => $desc) { $group = 'customerror_' . $code . '_group'; $form[$group] = array( '#type' => 'fieldset', @@ -80,7 +98,7 @@ $form[$group]['customerror_' . $code . '_title'] = array( '#type' => 'textfield', '#title' => t('Title for @code', array('@code' => $code)), - '#default_value' => variable_get('customerror_' . $code . '_title', $desc), + '#default_value' => $title, '#size' => 70, '#maxlength' => 70, '#description' => t('Title of @code error page', array('@code' => $code . ' error page')), @@ -88,14 +106,14 @@ $form[$group]['customerror_' . $code] = array( '#type' => 'textarea', '#title' => t('Description for ') . $code, - '#default_value' => variable_get('customerror_' . $code, $desc), + '#default_value' => $message, '#rows' => 10, '#description' => t('This text will be displayed if a @code (@desc) error occurs.', array('@code' => $code, '@desc' => $desc)), ); $form[$group]['customerror_' . $code . '_php'] = array( '#type' => 'checkbox', '#title' => t('Allow PHP code to be executed for @code', array( '@code' => $code)), - '#default_value' => variable_get('customerror_' . $code . '_php', FALSE), + '#default_value' => $use_php, '#description' => t('This allows you to include PHP code (enclosed in <?php ?> tags) for the @code (@desc) message. Note that this can be dangerous in some situations. Make sure that you are aware of the implications.', array('@code' => $code, '@desc' => $desc)), ); }