diff --git a/admin/index.php b/admin/index.php
index 3974f953..957fe1b6 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -30,11 +30,6 @@ if(!$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 this url.');
}
-// event system
-require_once SYSTEM . 'hooks.php';
-$hooks = new Hooks();
-$hooks->load();
-
require SYSTEM . 'status.php';
require SYSTEM . 'login.php';
require __DIR__ . '/includes/functions.php';
diff --git a/index.php b/index.php
index 5ead45b9..c6e76919 100644
--- a/index.php
+++ b/index.php
@@ -71,10 +71,6 @@ if(!$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 this url.');
}
-// event system
-require_once SYSTEM . 'hooks.php';
-$hooks = new Hooks();
-$hooks->load();
require_once SYSTEM . 'template.php';
require_once SYSTEM . 'login.php';
require_once SYSTEM . 'status.php';
diff --git a/system/hooks.php b/system/hooks.php
index b6480ae4..df9e26df 100644
--- a/system/hooks.php
+++ b/system/hooks.php
@@ -76,6 +76,7 @@ define('HOOK_GUILDS_AFTER_GUILD_HEADER', ++$i);
define('HOOK_GUILDS_AFTER_GUILD_INFORMATION', ++$i);
define('HOOK_GUILDS_AFTER_GUILD_MEMBERS', ++$i);
define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i);
+define('HOOK_TWIG', ++$i);
const HOOK_FIRST = HOOK_STARTUP;
define('HOOK_LAST', $i);
diff --git a/system/init.php b/system/init.php
index cf4b3f9b..3d8ded42 100644
--- a/system/init.php
+++ b/system/init.php
@@ -33,6 +33,11 @@ if(isset($config['gzip_output']) && $config['gzip_output'] && isset($_SERVER['HT
require_once SYSTEM . 'libs/cache.php';
$cache = Cache::getInstance();
+// event system
+require_once SYSTEM . 'hooks.php';
+$hooks = new Hooks();
+$hooks->load();
+
// twig
require_once SYSTEM . 'twig.php';
diff --git a/system/twig.php b/system/twig.php
index 5eb35c68..f82717a5 100644
--- a/system/twig.php
+++ b/system/twig.php
@@ -124,3 +124,5 @@ $filter = new TwigFilter('urlencode', function ($s) {
$twig->addFilter($filter);
unset($function, $filter);
+
+$hooks->trigger(HOOK_TWIG, ['twig' => $twig, 'twig_loader' => $twig_loader]);