From 4f269f68612cdf88121a2fbe46b7f1316e2a4808 Mon Sep 17 00:00:00 2001 From: William Jacoby Date: Sun, 1 Nov 2026 18:55:41 -0600 Subject: [PATCH 1/2] Add settings to show or hide each navigation link The extension adds a "Contact us" link to both the header and the footer navigation bars, and one variable controlled both. Two new ACP settings under General options turn each link on or off separately. A new migration adds them switched on, so boards that update see no change. The contact page, and the links on failed logins and the registration page, are not affected. Requested by Fred Rimbert on the phpBB Modders forum (t=150). Co-Authored-By: Claude Opus 5.5 --- adm/style/acp_contactadmin.html | 12 ++++++ controller/admin_controller.php | 4 ++ event/listener.php | 4 ++ language/en/acp_contact.php | 4 ++ migrations/m6_update_data.php | 37 +++++++++++++++++++ .../event/overall_footer_teamlink_after.html | 2 +- .../overall_header_navigation_append.html | 2 +- .../event/overall_footer_teamlink_after.html | 2 +- .../overall_header_navigation_append.html | 2 +- 9 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 migrations/m6_update_data.php diff --git a/adm/style/acp_contactadmin.html b/adm/style/acp_contactadmin.html index 4dbec69..3da1ff5 100644 --- a/adm/style/acp_contactadmin.html +++ b/adm/style/acp_contactadmin.html @@ -96,6 +96,18 @@

{{ lang('ACP_CAT_CONTACTADMIN') }}

{{ lang('CONTACT_WHO_EXPLAIN') }}
{% for option in loops.contact_who %}{% endfor %}
+
+

+ {{ lang('CONTACT_HEADER_LINK_EXPLAIN') }}
+
+
+
+
+

+ {{ lang('CONTACT_FOOTER_LINK_EXPLAIN') }}
+
+
+
{{ lang('CONTACT_POST_OPTIONS') }} diff --git a/controller/admin_controller.php b/controller/admin_controller.php index 23fb676..b0527fd 100644 --- a/controller/admin_controller.php +++ b/controller/admin_controller.php @@ -262,6 +262,8 @@ public function display_options() 'CONTACT_USERNAME_CHK' => $this->config['contactadmin_username_chk'], 'CONTACT_EMAIL_CHK' => $this->config['contactadmin_email_chk'], 'CONTACT_GDPR' => $this->config['contactadmin_gdpr'], + 'CONTACT_HEADER_LINK' => $this->config['contactadmin_header_link'], + 'CONTACT_FOOTER_LINK' => $this->config['contactadmin_footer_link'], 'CONTACT_REASONS' => $contact_admin_reasons, 'CONTACT_METHOD_EMAIL' => (int) $contact_method_email, 'CONTACT_METHOD_PM' => (int) $contact_method_pm, @@ -353,6 +355,8 @@ protected function set_options() $this->config->set('contactadmin_bot_poster', $this->allowed_value($this->request->variable('contact_bot_poster', 0), [$constants['CONTACT_POST_NEITHER'], $constants['CONTACT_POST_GUEST'], $constants['CONTACT_POST_ALL']])); $this->config->set('contactadmin_forum', $this->request->variable('forum', 0)); $this->config->set('contactadmin_gdpr', $this->request->variable('gdpr', 0)); + $this->config->set('contactadmin_header_link', $this->request->variable('header_link', 0)); + $this->config->set('contactadmin_footer_link', $this->request->variable('footer_link', 0)); } /** diff --git a/event/listener.php b/event/listener.php index 8c64d34..ee8a681 100644 --- a/event/listener.php +++ b/event/listener.php @@ -155,6 +155,10 @@ public function page_header_after($event) $this->template->assign_vars([ 'U_CONTACT_US' => false, 'U_CONTACTADMIN' => $this->helper->route('phpbbmodders_contactadmin_displayform'), + + // Which navigation bars show the "Contact us" link + 'S_CONTACTADMIN_HEADER_LINK' => !empty($this->config['contactadmin_header_link']), + 'S_CONTACTADMIN_FOOTER_LINK' => !empty($this->config['contactadmin_footer_link']), ]); } } diff --git a/language/en/acp_contact.php b/language/en/acp_contact.php index e7c6cdb..d08700d 100644 --- a/language/en/acp_contact.php +++ b/language/en/acp_contact.php @@ -70,6 +70,10 @@ 'CONTACT_USERNAME_CHK_EXPLAIN' => 'If set yes, the user’s name that is entered will be checked against those in the database. If the name is found the user will be presented with an error and asked to input a different user name', 'CONTACT_EMAIL_CHK' => 'Check Email', 'CONTACT_EMAIL_CHK_EXPLAIN' => 'If set yes, the user’s email address will be checked against those in the database. If the email address is found the user will be presented with an error and asked to input a different email address', + 'CONTACT_HEADER_LINK' => 'Show link in header navigation', + 'CONTACT_HEADER_LINK_EXPLAIN' => 'Show a “Contact us” link in the navigation bar at the top of every page.', + 'CONTACT_FOOTER_LINK' => 'Show link in footer navigation', + 'CONTACT_FOOTER_LINK_EXPLAIN' => 'Show a “Contact us” link in the navigation bar at the bottom of every page. With both links off, the contact page still works at its usual address.', // Contact methods 'CONTACT_METHOD_EMAIL' => 'Email', diff --git a/migrations/m6_update_data.php b/migrations/m6_update_data.php new file mode 100644 index 0000000..f8cc1e6 --- /dev/null +++ b/migrations/m6_update_data.php @@ -0,0 +1,37 @@ +config['contactadmin_header_link']); + } + + public static function depends_on() + { + return ['\phpbbmodders\contactadmin\migrations\m5_update_data']; + } + + public function update_data() + { + return [ + ['config.add', ['contactadmin_header_link', 1]], + ['config.add', ['contactadmin_footer_link', 1]], + ]; + } +} diff --git a/styles/prosilver/template/event/overall_footer_teamlink_after.html b/styles/prosilver/template/event/overall_footer_teamlink_after.html index cddad60..89194fe 100644 --- a/styles/prosilver/template/event/overall_footer_teamlink_after.html +++ b/styles/prosilver/template/event/overall_footer_teamlink_after.html @@ -1,4 +1,4 @@ -{% if U_CONTACTADMIN %} +{% if U_CONTACTADMIN and S_CONTACTADMIN_FOOTER_LINK %}
  • {{ lang('CONTACT_US') }} diff --git a/styles/prosilver/template/event/overall_header_navigation_append.html b/styles/prosilver/template/event/overall_header_navigation_append.html index 89e38e0..c7de65c 100644 --- a/styles/prosilver/template/event/overall_header_navigation_append.html +++ b/styles/prosilver/template/event/overall_header_navigation_append.html @@ -1,4 +1,4 @@ -{% if U_CONTACTADMIN %} +{% if U_CONTACTADMIN and S_CONTACTADMIN_HEADER_LINK %}
  • {{ lang('CONTACT_US') }} diff --git a/styles/scaffoldBB/template/event/overall_footer_teamlink_after.html b/styles/scaffoldBB/template/event/overall_footer_teamlink_after.html index 59dc3af..ad0330b 100644 --- a/styles/scaffoldBB/template/event/overall_footer_teamlink_after.html +++ b/styles/scaffoldBB/template/event/overall_footer_teamlink_after.html @@ -1,4 +1,4 @@ -{% if U_CONTACTADMIN %} +{% if U_CONTACTADMIN and S_CONTACTADMIN_FOOTER_LINK %}