It won't look as nice as a "site maintenance" message, but removing the "access content" privilege from anonymous users will likely do the trick.
I've never done what you're suggesting in a template, but I use exactly that strategy in my cas module. (make a simple module that runs implements hook_init() that does this check, and redirects the user with "drupal_goto".
You might be able to do it in the template but be careful about things that might send output before you try the redirect.
For what you need it would be about a five line module, call it say force_login.module.
function force_login_init() { global $user; if (!$user->uid) drupal_goto('user/login'); }
Then your master switch is simply enabling/disabling this module.
Dave
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of jp.stacey@torchbox.com Sent: Wednesday, June 20, 2007 7:34 AM To: support@drupal.org Subject: [support] Switching anonymous access to the whole site on and off
Hi,
What would be the quickest way to switch anonymous access to a site on and off? We have a large and fairly complex site almost ready to go, but we need third parties (with logins) to fill in and test content before it goes live.
As we've a lot of modules we've got quite complex permissions already, so checking and unchecking a lot of fields would be difficult to do quickly. Is there any "master switch" permission we can fix to lock it all down?
Otherwise, would it be worth putting a check for $user->uid in our template.php, and bouncing anyone to user/login if they don't have it set? Anyone see any problems with that?
Many thanks, J-P -- [ Drupal support list | http://lists.drupal.org/ ]