Hi there,
I’m using the login snippet for my site, which cannot be accessed by anyone who isn’t logged in. Thats all working nicely, but I want to be able to redirect users who are not logged in (and try to access a secure area of the site) to the login form.
At the moment, when I try going to an unauthorized page without being logged in, I just get a blank page, and when I look at the source, it looks like its tried to load one of the pages, but stops after loading several lines of the code (it usually stops somewhere in the head tag during my .js script references).
I tried adding a snippet to the top of each of my templates which reads:
<?php
if (!userLoggedIn()) {
$url = $modx->makeUrl(1);
$modx->sendRedirect($url);
}
But this doesn’t seem to be working.
Any ideas?!
Thanks