Skip to content

Instantly share code, notes, and snippets.

@cafuego
Created September 3, 2013 00:01
Show Gist options
  • Save cafuego/6418333 to your computer and use it in GitHub Desktop.
Save cafuego/6418333 to your computer and use it in GitHub Desktop.
mess with Drupal 7 status messages
/**
* Implements hook_preprocess_status_messages().
*
* Remove the login warning message, anon users can only see the login form anyway.
*/
function intranet_preprocess_status_messages(&$vars) {
$messages = drupal_get_messages('error');
if (!empty($messages['error'])) {
$errors = $messages['error'];
foreach ($errors as $error) {
if ($error == t('Access denied. You may need to login below or register to access this page.')) {
continue;
}
drupal_set_message($error, 'error');
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment