Turn off Error Messages... but keep all others?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
spessex's picture

Is it possible just to turn-off error messages but show all other messages, particularly showing only the green system messages? The 'Error messages to display' does not appear to allow for this.

Most of you will probably thinking 'why do you need this', but unfortunately due to circumstances I have no other choice at this time but to do this.

Any advice would be greatly appreciated.

Stephen

Comments

If you're comfortable writing

alanmackenzie's picture

If you're comfortable writing a small custom module you can do this to clear all error and warning messages:

/**
* Implements hook_init().
*/
function example_init() {
  drupal_get_messages('warning', TRUE);
  drupal_get_messages('error', TRUE);
}

It's worth reading the documentation on drupal_get_messages().

Disclaimer: It's probably more worthwhile to fix the root of this issue rather than hiding it, the above code will remove all form validation error messages as well.

Brilliant. Thank you Alan

spessex's picture

Brilliant. Thank you Alan

Hi spessex You can disable

asghar's picture

Hi spessex

You can disable warning and error messages by admin configurations page http:///config/development/logging.

Thank you but the problem was

spessex's picture

Thank you but the problem was that you can only turn off 'all' messages, hence you cannot then see the green messages using this method.