Required to login help

Posted on 16th Feb 2014 by admin

I'm trying to set up my site so users have to be logged into the forum to access the site.I've been working with this bit of code
Code: [Select]<?php
writeLog();
if ($context['user']['is_logged'])
?>
<?php
else if ($context['user']['is_guest'])
{
redirectexit('action=login');
}
?>
But the problem is that it won't let me stay on the requested page. It'll still redirects even if you are logged in. I want it to check if you are logged in. Then stay on current page as normal, and if you'r not logged in. To redirect you to the login page of the forum.

Any help on this would be great.

Other forums