From 93641fc68ac9a5f1479329e2bd41380c19534d5d Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 8 Sep 2024 15:03:18 +0200 Subject: [PATCH] New hooks in account manage + create --- system/pages/account/create.php | 6 ++++++ system/src/global.php | 6 ++++++ system/templates/account.management.html.twig | 4 ++++ templates/tibiacom/account.management.html.twig | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/system/pages/account/create.php b/system/pages/account/create.php index 0074f9e3..9fba8237 100644 --- a/system/pages/account/create.php +++ b/system/pages/account/create.php @@ -148,6 +148,10 @@ if($save) } } + /** + * two hooks for compatibility + */ + $hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SUBMIT, $params); if (!$hooks->trigger(HOOK_ACCOUNT_CREATE_POST, $params)) { return; } @@ -187,6 +191,8 @@ if($save) $new_account->setEMail($email); $new_account->save(); + $hooks->trigger(HOOK_ACCOUNT_CREATE_AFTER_SAVED, ['account' => $new_account]); + if(USE_ACCOUNT_SALT) $new_account->setCustomField('salt', $salt); diff --git a/system/src/global.php b/system/src/global.php index d4bd0cc4..e106a57c 100644 --- a/system/src/global.php +++ b/system/src/global.php @@ -45,6 +45,12 @@ 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_POST', ++$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_ACCOUNT_LOGIN_BEFORE_PAGE', ++$i); define('HOOK_ACCOUNT_LOGIN_BEFORE_ACCOUNT', ++$i); define('HOOK_ACCOUNT_LOGIN_AFTER_ACCOUNT', ++$i); diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig index db8c766f..87a33b6a 100644 --- a/system/templates/account.management.html.twig +++ b/system/templates/account.management.html.twig @@ -88,6 +88,7 @@

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

General Information

@@ -127,6 +128,7 @@ {% endautoescape %}

+ {{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}

Public Information

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

Action Log

@@ -164,6 +167,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 773ce6c9..6ce10274 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') }}
@@ -221,6 +222,7 @@ {% endset %} {% include 'tables.headline.html.twig' %}
+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_PUBLIC_INFORMATION') }}
@@ -280,6 +282,7 @@ {% endset %} {% include 'tables.headline.html.twig' %}
+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_ACCOUNT_LOGS') }}
@@ -333,6 +336,7 @@ {% endset %} {% include 'tables.headline.html.twig' %}
+{{ hook('HOOK_ACCOUNT_MANAGE_BEFORE_CHARACTERS') }}