From dbe2e8f50c2ee01557520aacad9f1d343c6b0ddd Mon Sep 17 00:00:00 2001 From: jdarwood007 Date: Fri, 8 Aug 2025 09:25:52 -0700 Subject: [PATCH 1/2] [2.1] Users couldn't toggle word censor if the admin allowed it --- Sources/Profile-Modify.php | 11 ++++++++--- Themes/default/Settings.template.php | 5 +++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Sources/Profile-Modify.php b/Sources/Profile-Modify.php index da360e90af4..c0e829e3ebe 100644 --- a/Sources/Profile-Modify.php +++ b/Sources/Profile-Modify.php @@ -562,9 +562,14 @@ function $preload: A function that is used to load data required for this eleme { loadLanguage('Settings'); - $context['allow_no_censored'] = false; - if ($user_info['is_admin'] || $context['user']['is_owner']) - $context['allow_no_censored'] = !empty($modSettings['allow_no_censored']); + if (empty($modSettings['allow_no_censored'])) { + foreach ($context['theme_options'] as $k => $v) { + if (is_array($v) && $v['id'] === 'show_no_censored') { + unset($context['theme_options'][$k]); + break; + } + } + } return true; }, diff --git a/Themes/default/Settings.template.php b/Themes/default/Settings.template.php index 470363b3134..f372a7a3218 100644 --- a/Themes/default/Settings.template.php +++ b/Themes/default/Settings.template.php @@ -65,6 +65,11 @@ function template_options() 'label' => $txt['show_no_signatures'], 'default' => true, ), + array( + 'id' => 'show_no_censored', + 'label' => $txt['show_no_censored'], + 'default' => false, + ), array( 'id' => 'posts_apply_ignore_list', 'label' => $txt['posts_apply_ignore_list'], From 9d8a9be302baad1234cfcd6e794ea4ab2520f9ac Mon Sep 17 00:00:00 2001 From: Jeremy D Date: Thu, 21 Aug 2025 17:22:35 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Jon Stovell --- Sources/Profile-Modify.php | 8 -------- Themes/default/Settings.template.php | 1 + 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Sources/Profile-Modify.php b/Sources/Profile-Modify.php index c0e829e3ebe..40b76fafb88 100644 --- a/Sources/Profile-Modify.php +++ b/Sources/Profile-Modify.php @@ -562,14 +562,6 @@ function $preload: A function that is used to load data required for this eleme { loadLanguage('Settings'); - if (empty($modSettings['allow_no_censored'])) { - foreach ($context['theme_options'] as $k => $v) { - if (is_array($v) && $v['id'] === 'show_no_censored') { - unset($context['theme_options'][$k]); - break; - } - } - } return true; }, diff --git a/Themes/default/Settings.template.php b/Themes/default/Settings.template.php index f372a7a3218..ebad0ae39b3 100644 --- a/Themes/default/Settings.template.php +++ b/Themes/default/Settings.template.php @@ -69,6 +69,7 @@ function template_options() 'id' => 'show_no_censored', 'label' => $txt['show_no_censored'], 'default' => false, + 'enabled' => !empty($modSettings['allow_no_censored']), ), array( 'id' => 'posts_apply_ignore_list',