Thank for reply. I have added bot for some reason it didn't work. but now it seems ok but I get null even if the user is logged in.
I have tried to use $user = $app->getIdentity();
and if (Factory::$application === null) {
Factory::$application = $app;
}
Both shows in var_dump($user); null so I have tried var_dump on $app and it actually doesn't contain any logged user data.
Code:
<?phpdefine('_JEXEC', 1);defined('_JEXEC') or die;define('JPATH_BASE','../');require_once JPATH_BASE . '/includes/defines.php';require_once JPATH_BASE . '/includes/framework.php';use Joomla\CMS\Factory;use Joomla\CMS\Log\Log;use Joomla\CMS\Helper\ModuleHelper;use Joomla\Session\SessionInterface;use Joomla\CMS\Application\SiteApplication;$container = Factory::getContainer();$container->alias(SessionInterface::class, 'session.web.site');$app = $container->get(SiteApplication::class);
and if (Factory::$application === null) {
Factory::$application = $app;
}
Both shows in var_dump($user); null so I have tried var_dump on $app and it actually doesn't contain any logged user data.
Statistics: Posted by Poutnik81 — Mon Jan 08, 2024 1:25 pm