Option 1: Use the Disable Messages module
Use the Disable Messages module for this. Here is a quote from its project page:
Gives a site owner options to disable specific messages shown to end users. The core drupal message system as offered by drupal_set_message is an excellent way for modules to send out messages to the end users. However not all drupal site owners are keen to show all the messages sent out by drupal core and all modules to their users. This module gives site administrators a reasonably powerful way to filter out messages shown to the end users.
Some of its features are:
- Filter out messages that match a full text string exactly.
- Filter out messages that match a regular expression.
- Permissions to specifically hide all messages of a given type from any role.
- Disable all filtering for specific users.
- Disable all filtering for specific paths.
- Apply filtering only for specific paths.
- Debug system to get messages in the HTML without showing it to the end users.
Available for either Drupal 6 or Drupal 7 (and a DEV version for Drupal 8).
Option 2: Write your custom code
Use a variation of the approach as explained on Hook into and Preprocess Drupal Messages? Here is a quote from it:
The following example hides all error/warning messages from anonymous users and user's who don't have the 'administer nodes' permission. You can easily add your own conditions to filter out which message types should be displayed to who.
function mytheme_status_messages ($display = NULL) {
$output = '';
foreach (drupal_get_messages($display) as $type => $messages) {
// skip all error/warning messages for anonymous users
if (!user_is_logged_in() && ($type == "error" || $type == "warning")) { continue; }
// skip error/warning messages for users who don't have the 'administer nodes' permission
else if (!user_access('administer nodes') && ($type == "error" || $type == "warning")) { continue; }
...