[support] Switching anonymous access to the whole site on and off

jp.stacey at torchbox.com jp.stacey at torchbox.com
Wed Jun 20 15:35:49 UTC 2007


Hi,

> 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".

Thanks for that: it worked, but as written it put the browser into an
infinite-redirect loop (is drupal_goto() meant to avoid that?) Changing
the if statement to:

  if ((!$user->uid) && ($_GET['q'] != 'user/login'))

fixed the loop. I suppose e.g. (arg(0) != "user") instead would permit
user/register to be visited?

Cheers,
J-P


More information about the support mailing list