BrianV
BrianV

Reputation: 416

Suppress Drupal status messages by role?

Is it possible to suppress the status messages set by drupal_set_messages() for certain roles? One client does not want certain roles (anonymous) to see these messages.

Upvotes: 1

Views: 753

Answers (1)

Niels
Niels

Reputation: 9384

(Untested)

global $user;

  <?php if (!in_array('anonymous', array_values($user->roles)) && $show_messages && $messages): ?> 
      <?php print $messages; ?>          
  <?php endif; ?>

Upvotes: 2

Related Questions