array(
      'title' => t('View status messages'),
    ),
    'view warning messages' => array(
      'title' => t('View warning messages'),
    ),
    'view error messages' => array(
      'title' => t('View error messages'),
    ),
    'exclude from message filtering' => array(
      'title' => t('Exclude from message filtering'),
    ),
  );
}
/**
 * Implements hook_menu().
 */
function disable_messages_menu() {
  $items = array();
  $items['admin/config/development/disable-messages'] = array(
    'title' => 'Disable messages',
    'description' => 'Configure display of messages to end users.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('disable_messages_settings_form'),
    'access arguments' => array('administer site configuration'),
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}
/**
 * Implements hook_theme().
 */
function disable_messages_theme($existing, $type, $theme, $path) {
  $items = array();
  // Expose a disable_messages_status_messages theme hook that can be
  // overridden by the themer to override the message display
  $items['disable_messages_status_messages'] = array(
    'variables' => array('messages' => NULL),
  );
  return $items;
}
/**
 * Implements hook_theme_registry_alter().
 */
function disable_messages_theme_registry_alter(&$theme_registry) {
  $theme_registry['status_messages']['function'] = '_theme_disable_messages_status_messages';
}
/**
 * Implementation of theme_status_messages() hook to override the core
 * status message output.
 */
function _theme_disable_messages_status_messages($variables) {
  $display = $variables['display'];
  // Retrieve messages
  $messages = drupal_get_messages($display);
  // Filter messages if filtering is enabled.
  if (variable_get('disable_messages_enable', '1')) {
    $messages = disable_messages_apply_filters($messages);
  }
  
  // Return themed status messages
  return theme('disable_messages_status_messages', array('messages' => $messages));
}
/**
 * Theme function for theming status messages
 */
function theme_disable_messages_status_messages($vars) {
  $messages = $vars['messages'];
  $output = '';
  $status_heading = array(
    'status' => t('Status message'),
    'error' => t('Error message'),
    'warning' => t('Warning message'),
  );
  foreach ($messages as $type => $arr_messages) {
    $output .= "
\n";
    if (!empty($status_heading[$type])) {
      $output .= '
' . $status_heading[$type] . "
\n";
    }
    if (count($arr_messages) > 1) {
      $output .= " 
\n";
      foreach ($arr_messages as $message) {
        $output .= '  - ' . $message . "\n";
      }
      $output .= "
\n";
    }
    else {
      $output .= array_shift($arr_messages);
    }
    $output .= "
' .
      '
' .
        check_plain(var_export(disable_messages_cache_messages(), TRUE)) .
      '' .
    '