* @git Joomla Component Builder * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); use Joomla\CMS\Factory; use Joomla\CMS\Helper\ModuleHelper; // get the set values form cpanel redirect module $redirect = $params->get('redirect',null); // redirect if the user is in given selected group if ($redirect && is_object($redirect) && count((array)$redirect) > 0) { // get application $app = Factory::getApplication(); // set the user object $user = Factory::getUser(); // get user groups $groups = (array) $user->getAuthorisedGroups(); // loop over the set values foreach ($redirect as $go) { if (is_object($go)) { if (is_array($go->groups) && count($go->groups)) { if (array_intersect($go->groups, $groups)) { // match found - redirect $app->redirect($go->url); break; } } } } } // get the module class sfx (local) $moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8'); // load the default Tmpl require ModuleHelper::getLayoutPath('mod_siteredirect', $params->get('layout', 'default'));