Disable status messages for all forms

Public

Disable status messages for all forms (showing after saving or updating nodes/entities).

</> CopyGet raw version
php
  1. function modulename_form_alter(&$form, $form_state, $form_id) {
  2. if (!user_access('administer site configuration')) {
  3. $form['#validate'][] = '_modulename_custom_form_validate';
  4. }
  5. }
  6.  
  7. function _modulename_custom_form_validate($form, &$form_state) {
  8. $form_state['submit_handlers'][] = '_modulename_disable_status_messages';
  9. }
  10.  
  11. function _modulename_disable_status_messages($form, &$form_state) {
  12. drupal_get_messages('status');
  13. }