From 1e9b10d6489c488cadf7f6ed17b42f1ea6c767a8 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 15 May 2025 19:11:20 +0200 Subject: [PATCH] Fix twig variables: logged + account_logged being not set directly after login --- system/init.php | 3 +++ system/pages/account/login.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/system/init.php b/system/init.php index ba2990db..44634265 100644 --- a/system/init.php +++ b/system/init.php @@ -138,6 +138,9 @@ $ots = POT::getInstance(); $eloquentConnection = null; require_once SYSTEM . 'database.php'; +$twig->addGlobal('logged', false); +$twig->addGlobal('account_logged', new \OTS_Account()); + // verify myaac tables exists in database if(!defined('MYAAC_INSTALL') && !$db->hasTable('myaac_account_actions')) { throw new RuntimeException('Seems that the table myaac_account_actions of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting ' . (IS_CLI ? 'http://your-ip.com/' : BASE_URL) . 'install'); diff --git a/system/pages/account/login.php b/system/pages/account/login.php index 3e8ebba3..c95019d6 100644 --- a/system/pages/account/login.php +++ b/system/pages/account/login.php @@ -95,3 +95,8 @@ else { } $hooks->trigger(HOOK_ACCOUNT_LOGIN_POST); + +if($logged) { + $twig->addGlobal('logged', true); + $twig->addGlobal('account_logged', $account_logged); +}