Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Home Page Views Version - 2.0.18

I've been trying to set up the theme view for the home page for visitors ( ie not logged in). When someone is logged in I know it uses the theme/views/default.master.php

I've been digging, a lot, and cannot find the view that the home page uses. Could anyone enlighten me please?

Cheers

Dave

Comments

  • R_JR_J Admin

    The default.master.php/default.master.tpl is used for all visitors. The default.master can be understood as a layout file:

    ---------------
    |Menu        | 
    ---------------
    |panel|content |
    ---------------
    |Footer      | 
    ---------------
    

    If you want to present visitors another page than logged in users, you should consider redirecting them early. Either make this a theme hook or a plugin:

        public function gdn_dispatcher_beforeAnalyzeRequest_handler($sender, $args) {
            // Exit when user is logged in.
            if (Gdn::session()->isValid()) {
                return;
            }
            // Exit when this is not the home page.
            if (c('Routes.DefaultController', '')[0] != $sender->Request) {
                return;
            }
            // When guests visit home page, show them custom page
            redirectTo('/plugin/helloguest');
        }
        public function pluginController_helloGuest_create($sender) {
            echo 'Hello Guest!';
            // Better:
            // $sender->render('helloguest', '' 'plugins/helloguest');
        }
    
  • R_JR_J Admin
    edited June 2018

    Oh, there is a plugin which does half of the job...
    https://open.vanillaforums.com/addon/guestdefaultroute-plugin

    Together with some other plugin you will not need to write anything on your own: https://open.vanillaforums.com/addon/basicpages-plugin

Sign In or Register to comment.