Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A contact form that lets guests and members reach the board administrators by em

## Features

- Replaces phpBB's built-in contact page and links to it from the header, the footer, failed logins and the registration page.
- Replaces phpBB's built-in contact page and links to it from the header, the footer, failed logins and the registration page. The header and footer links can each be turned off in the ACP.
- Messages go out by email, as a private message, or as a post in a forum you choose. Send to all administrators, the board founder or the board's default email address.
- Optional list of contact reasons for the sender to pick from.
- Private messages and posts can come from a "contact bot" user, for guests only or for everyone.
Expand Down
12 changes: 12 additions & 0 deletions adm/style/acp_contactadmin.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ <h1>{{ lang('ACP_CAT_CONTACTADMIN') }}</h1>
<span>{{ lang('CONTACT_WHO_EXPLAIN') }}</span></dt>
<dd>{% for option in loops.contact_who %}<label><input type="radio" class="radio" name="contact_who" value="{{ option.VALUE }}"{% if loop.first %} id="contact_who"{% endif %}{% if option.S_CHECKED %} checked="checked"{% endif %} /> {{ option.LABEL }}</label>{% endfor %}</dd>
</dl>
<dl>
<dt><label for="header_link">{{ lang('CONTACT_HEADER_LINK') ~ lang('COLON') }}</label><br>
<span>{{ lang('CONTACT_HEADER_LINK_EXPLAIN') }}</span></dt>
<dd><label><input type="radio" class="radio" name="header_link" value="1" {% if CONTACT_HEADER_LINK %}id="header_link" checked="checked"{% endif %} /> {{ lang('YES') }}</label>
<label><input type="radio" class="radio" name="header_link" value="0" {% if not CONTACT_HEADER_LINK %}id="header_link" checked="checked"{% endif %} /> {{ lang('NO') }}</label></dd>
</dl>
<dl>
<dt><label for="footer_link">{{ lang('CONTACT_FOOTER_LINK') ~ lang('COLON') }}</label><br>
<span>{{ lang('CONTACT_FOOTER_LINK_EXPLAIN') }}</span></dt>
<dd><label><input type="radio" class="radio" name="footer_link" value="1" {% if CONTACT_FOOTER_LINK %}id="footer_link" checked="checked"{% endif %} /> {{ lang('YES') }}</label>
<label><input type="radio" class="radio" name="footer_link" value="0" {% if not CONTACT_FOOTER_LINK %}id="footer_link" checked="checked"{% endif %} /> {{ lang('NO') }}</label></dd>
</dl>
</fieldset>
<fieldset class="contact-options">
<legend>{{ lang('CONTACT_POST_OPTIONS') }}</legend>
Expand Down
4 changes: 4 additions & 0 deletions controller/admin_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
}

/**
Expand Down
4 changes: 4 additions & 0 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
]);
}
}
Expand Down
4 changes: 4 additions & 0 deletions language/en/acp_contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
37 changes: 37 additions & 0 deletions migrations/m6_update_data.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
*
* Contact Admin extension for the phpBB Forum Software package
*
* @copyright (c) 2026, phpBB Modders, https://www.phpbbmodders.com/
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

namespace phpbbmodders\contactadmin\migrations;

/**
* Add separate settings for the header and footer navigation links
*
* Both start on, so boards that update keep showing both links.
*/
class m6_update_data extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return isset($this->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]],
];
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if U_CONTACTADMIN %}
{% if U_CONTACTADMIN and S_CONTACTADMIN_FOOTER_LINK %}
<li class="rightside" data-last-responsive="true">
<a href="{{ U_CONTACTADMIN }}" role="menuitem">
<i class="icon o-icon o-icon-font fa-fw fa-envelope fas" aria-hidden="true"></i><span>{{ lang('CONTACT_US') }}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if U_CONTACTADMIN %}
{% if U_CONTACTADMIN and S_CONTACTADMIN_HEADER_LINK %}
<li data-last-responsive="true">
<a href="{{ U_CONTACTADMIN }}" role="menuitem">
<i class="icon o-icon o-icon-font fa-fw fa-envelope fas" aria-hidden="true"></i><span>{{ lang('CONTACT_US') }}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if U_CONTACTADMIN %}
{% if U_CONTACTADMIN and S_CONTACTADMIN_FOOTER_LINK %}
<li class="nav-item rightside" data-last-responsive="true">
<a class="nav-link px-1 py-0 text-body" href="{{ U_CONTACTADMIN }}" role="menuitem">
<i class="icon fa fs-5 fa-envelope fa-fw" aria-hidden="true"></i><span>{{ lang('CONTACT_US') }}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% if U_CONTACTADMIN %}
{% if U_CONTACTADMIN and S_CONTACTADMIN_HEADER_LINK %}
<li class="nav-item" data-last-responsive="true">
<a class="nav-link px-1 py-0 text-body" href="{{ U_CONTACTADMIN }}" role="menuitem">
<i class="icon fa fs-5 fa-envelope fa-fw" aria-hidden="true"></i><span>{{ lang('CONTACT_US') }}</span>
Expand Down
Loading