You know, you can close a Drupal site anytime for maintenance, don't you? You just go to "Administration -> Site configuration -> Site maintenance" and deactivate the site. From this moment on, no-one can see your website while you're working at it.
BUT this also means, the moment you activate maintenance mode you kick everyone else off your site. This is very annoying when unexpected, so we should better find a way to add a warning to our site. Let's say, we want to add the message fifteen minutes before closing the site. Nothing fancy, just a persistent message saying "site will be closed at [time]", with the same style Drupal warning messages use.
It can't be that difficult.
It isn't.
Just go to your site's theme folder. Open your theme's template.php and add this line of code at the beginning of the file:
drupal_set_message('Please notice: site will be closed at [hh:mm]
for maintenance.', 'warning');
And that's all. On every page the visitor loads, our message will appear. No nasty surprises for our users.
More info on the drupal_set_message() function can be found here:
http://api.drupal.org/api/drupal/includes--bootstrap.inc/function/drupal_set_message/6
I thank for the helpful information!
An easy and clean solution. Thankx
Post new comment