From 6896357316da12e7852aa1a0060cb3b51ff379fe Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 29 Jan 2018 12:51:48 +0100 Subject: [PATCH] Prevent disabling of the 'Administrator' contact recipient --- .../files/acp/templates/contactRecipientAdd.tpl | 14 ++++++++------ .../acp/form/ContactRecipientEditForm.class.php | 14 ++++++++++++++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/contactRecipientAdd.tpl b/wcfsetup/install/files/acp/templates/contactRecipientAdd.tpl index 48c002ce07..6bab6a3ea4 100644 --- a/wcfsetup/install/files/acp/templates/contactRecipientAdd.tpl +++ b/wcfsetup/install/files/acp/templates/contactRecipientAdd.tpl @@ -74,12 +74,14 @@ -
-
-
- -
-
+ {if $action != 'edit' || !$recipient->isAdministrator} +
+
+
+ +
+
+ {/if} {event name='dataFields'} diff --git a/wcfsetup/install/files/lib/acp/form/ContactRecipientEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ContactRecipientEditForm.class.php index f7056dc67d..0fbd82dfc7 100644 --- a/wcfsetup/install/files/lib/acp/form/ContactRecipientEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ContactRecipientEditForm.class.php @@ -54,6 +54,20 @@ class ContactRecipientEditForm extends ContactRecipientAddForm { } } + /** + * @inheritDoc + */ + public function validate() { + parent::validate(); + + if ($this->recipient->isAdministrator) { + $this->isDisabled = 0; + } + } + + /** + * @inheritDoc + */ public function readData() { parent::readData(); -- 2.20.1