diff --git a/config/vufind/config.ini b/config/vufind/config.ini index e590deb7a1009b734f916509dc136bf3ed732442..81dc55cc7f54c6187bde774a2fb942d2a64d5541 100644 --- a/config/vufind/config.ini +++ b/config/vufind/config.ini @@ -86,12 +86,14 @@ displayDateFormat = "m-d-Y" ; A string used to format user interface time strings using the PHP date() function ; default is H:i (HH:MM 23:01) displayTimeFormat = "H:i" -; The base VuFind URL will load the "Home" action of this module unless the user -; is logged in: +; The base VuFind URL will load this controller unless the user is logged in: defaultModule = Search -; The base VuFind URL will load the "Home" action of this module when the user -; is logged in: +; When defaultModule is used, this action will be triggered (default = Home) +;defaultAction = Home +; The base VuFind URL will load this controller when the user is logged in: defaultLoggedInModule = MyResearch +; When defaultLoggedInModule is used, this action will be triggered (default = Home) +;defaultLoggedInAction = Home ; The route VuFind will send users to following a log out operation. Set to false ; or omit to attempt to retain the user's current context after log out. ;logOutRoute = home diff --git a/module/VuFind/src/VuFind/Controller/IndexController.php b/module/VuFind/src/VuFind/Controller/IndexController.php index a88057cde538b6507a1375dd81caef47ee7ba05a..d1c4c276962fd60271c52db745d7b3fe72e0a0a0 100644 --- a/module/VuFind/src/VuFind/Controller/IndexController.php +++ b/module/VuFind/src/VuFind/Controller/IndexController.php @@ -75,12 +75,20 @@ class IndexController extends \Zend\Mvc\Controller\AbstractActionController */ public function homeAction() { - $loggedInModule = isset($this->config->Site->defaultLoggedInModule) - ? $this->config->Site->defaultLoggedInModule : 'MyResearch'; - $loggedOutModule = isset($this->config->Site->defaultModule) - ? $this->config->Site->defaultModule : 'Search'; - $module = $this->authManager->isLoggedIn() - ? $loggedInModule : $loggedOutModule; - return $this->forward()->dispatch($module, ['action' => 'Home']); + // Load different configurations depending on whether we're logged in or not: + if ($this->authManager->isLoggedIn()) { + $controller = isset($this->config->Site->defaultLoggedInModule) + ? $this->config->Site->defaultLoggedInModule : 'MyResearch'; + $actionConfig = 'defaultLoggedInAction'; + } else { + $controller = isset($this->config->Site->defaultModule) + ? $this->config->Site->defaultModule : 'Search'; + $actionConfig = 'defaultAction'; + } + $action = isset($this->config->Site->$actionConfig) + ? $this->config->Site->$actionConfig : 'Home'; + + // Forward to the appropriate controller and action: + return $this->forward()->dispatch($controller, compact('action')); } }