Allow guest to view home page

I'd like to give guests the options of entering the site, and viewing the home page without having to register. How do I do this? Eg. I'll place a link "continue as Guest" which has a url like "/?guest=y"
Bernd Hansen Basic on 03/01/17 at 12:25 in mooSocial features
4 Answer(s)
UPDATE:
 
my first method didn't stop the landing page from reappearing whenever the Home link was clicked on the menu. I instituted a session cookie to address that. Here's the amended code:
 
if ($_GET['guest'] == "y") {setcookie('guest','y');}

        if(!$this->Auth->user('id') && ($uri =='home.index') &&  (!($_COOKIE['guest']) == 'y')) {
            $uri = "home.landing";
        }
        return $uri;
Bernd Hansen Basic on 03/01/17 at 15:58
Thanks layla. I wasn't able to do it there, but your answer took me to the right folder. In homecontroller.php, the in the finction currentUri,
there's a section:
 
        if(!$this->Auth->user('id') && ($uri =='home.index')) {
            $uri = "home.landing";
        }
 
I modified it to:
        if(!$this->Auth->user('id') && ($uri =='home.index') &&  (!($_GET['guest']) == "y")) {
            $uri = "home.landing";
        }
 
It works! thanks a bunch for replying!
Bernd Hansen Basic on 03/01/17 at 15:48
Let me know if it helped you
Layla Basic on 03/01/17 at 12:51
I don't have to test it but the file you must edit is

\app\Controller\AppController.php

Find:

) {
$this->redirect('/users/member_login');
exit;
}

Do something as:

) {

if(strpos($_SERVER["REQUEST_URI"], "guest=y") === false)
{
$this->redirect('/users/member_login');
exit;
}
}
Layla Basic on 03/01/17 at 12:50 Edited
Cookies on mooCommunity - Social Networking Script.
This site uses cookies to store your information on your computer.