From d40178104b0f411b9672102c49a4b87ac16e1779 Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 8 Sep 2024 06:23:17 +0200 Subject: [PATCH] New hooks in account manage + create --- system/hooks.php | 5 +++++ system/pages/createaccount.php | 2 ++ system/templates/account.management.html.twig | 4 ++++ templates/tibiacom/account.management.html.twig | 6 +++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/system/hooks.php b/system/hooks.php index 12e230b3..df63d68d 100644 --- a/system/hooks.php +++ b/system/hooks.php @@ -49,6 +49,11 @@ define('HOOK_ACCOUNT_CREATE_AFTER_TOWNS', ++$i); define('HOOK_ACCOUNT_CREATE_BEFORE_SUBMIT_BUTTON', ++$i); define('HOOK_ACCOUNT_CREATE_AFTER_FORM', ++$i); define('HOOK_ACCOUNT_CREATE_AFTER_SUBMIT', ++$i); +define('HOOK_ACCOUNT_CREATE_AFTER_SAVED', ++$i); +define('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION', ++$i); +define('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION', ++$i); +define('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS', ++$i); +define('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS', ++$i); define('HOOK_EMAIL_CONFIRMED', ++$i); define('HOOK_GUILDS_AFTER_INVITED_CHARACTERS', ++$i); define('HOOK_FIRST', HOOK_STARTUP); diff --git a/system/pages/createaccount.php b/system/pages/createaccount.php index a32408da..1e177e75 100644 --- a/system/pages/createaccount.php +++ b/system/pages/createaccount.php @@ -167,6 +167,8 @@ if($save) $new_account->setEMail($email); $new_account->save(); + $hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SAVED, ['account' => $new_account]); + if($config_salt_enabled) $new_account->setCustomField('salt', $salt); diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig index 8c37b502..65919558 100644 --- a/system/templates/account.management.html.twig +++ b/system/templates/account.management.html.twig @@ -86,6 +86,7 @@

{% endif %} + {{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION') }}

General Information

@@ -122,6 +123,7 @@ {% endautoescape %}

+ {{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}

Public Information

@@ -139,6 +141,7 @@ {% include('buttons.base.html.twig') %}
+ {{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS') }}

Account Logs

@@ -158,6 +161,7 @@ {% endautoescape %}

+ {{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS') }}

Character list: {{ players|length }} characters.

diff --git a/templates/tibiacom/account.management.html.twig b/templates/tibiacom/account.management.html.twig index 62fcf255..1a851bf0 100644 --- a/templates/tibiacom/account.management.html.twig +++ b/templates/tibiacom/account.management.html.twig @@ -111,6 +111,7 @@

{% endif %} +{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_GENERAL_INFORMATION') }}
@@ -236,6 +237,7 @@

+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}
@@ -313,6 +315,7 @@

+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS') }}
@@ -384,6 +387,7 @@

+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS') }}
@@ -516,4 +520,4 @@
-

\ No newline at end of file +