Simple Site-Wide Status Message to All Visitors

There are many modules to customize status messages on a Drupal website. Such messages could inform your users of scheduled maintenance downtime or other relevant notices you want any user to see when they visit your website. I suggest you consult this community comparison on drupal status message modules.

If these are too heavyweight for you there is a very simple solution. In your theme’s template.php file add the following line of code anywhere in YOURTHEME/template.php:

drupal_set_message(‘Please Notice: THE SKY IS FALLING!’, 'warning');

This message will show for all visitors of the site on every page.

If you want some more control over this message you could add the following code to your template.php file:

// in template.php for your theme directory.

// Show a message on every page.

// The message is pulled from a custom defined variable.
function MYTHEME_show_sitewide_notification_message() {
  $notice = variable_get('MYSITE_sitewide_notification', '');
  if ($notice != '') {
    drupal_set_message($notice, 'warning');

A developer could easily make a Drupal admin form with Drupal API hooks to allow a site user to edit this custom drupal variable. Or, if you site administer your site using Drush you can simply set the notification text as needed:

drush vset MYSITE_sitewide_notification ‘’; /* no message */
drush vset MYSITE_sitewide_notification ‘Please Notice: CHICKEN LITTLE WAS RIGHT!! THE SKY IS FALLING!’;

Looking for quality Drupal Web Hosting? Look no further than Arvixe Web Hosting!

Tags: , , , , , , , , , , , , | Posted under Drupal, Programming/Coding | RSS 2.0

Author Spotlight

David Gurba

I am a web programmer currently employed at UCSB. I have been developing web applications professionally for 8+ years now. For the last 5 years I’ve been actively developing websites primarily in PHP using Drupal. I have experience using LAMP and developing data driven websites for clients in aviation, higher education and e-commerce. If you’d like to contact me I can be reached at

Leave a Reply

Your email address will not be published. Required fields are marked *