Skip to content

Instantly share code, notes, and snippets.

@lefnire
Created June 4, 2012 19:46
Show Gist options
  • Save lefnire/2870431 to your computer and use it in GitHub Desktop.
Save lefnire/2870431 to your computer and use it in GitHub Desktop.
Drupal disable errors for anonymous
<?php
// Disable all errors
function MODULE_page_alter(&$page) {
global $user;
if (!$user->uid) {
unset($_SESSION['messages']['error']);
}
}
// Disable specific errors
function MODULE_page_alter(&$page) {
global $user;
if (!$user->uid) {
$errors = &$_SESSION['messages']['error'];
foreach ($errors as $key=>$val) {
if(strstr($val, 'ctools_get_plugins')) {
unset($errors[$key]);
}
}
if (empty($errors)) {
unset($_SESSION['messages']['error']);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment