From aa030bc89b3bf94d867223fedc1b852f902bfd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Andr=C3=A9s?= Date: Sat, 7 Jan 2023 14:37:47 -0600 Subject: [PATCH] pre-select a prefix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Diego Andrés --- Sources/PostPrefix/Integration/Posting.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/PostPrefix/Integration/Posting.php b/Sources/PostPrefix/Integration/Posting.php index c667f3f..71d93ba 100644 --- a/Sources/PostPrefix/Integration/Posting.php +++ b/Sources/PostPrefix/Integration/Posting.php @@ -233,13 +233,14 @@ public static function post_end() : void // Add the list of prefixes to the options if (!empty($context['user_prefixes']['post'])) { + $selected_prefix = (int) isset($_REQUEST['prefix']) ? $_REQUEST['prefix'] : 0; foreach ($context['user_prefixes']['post'] as $prefix_id => $prefix) { $context['posting_fields']['topic_prefix']['input']['options']['PostPrefix_select_prefix']['options'][$prefix_id] = [ 'label' => !empty($modSettings['PostPrefix_post_selecttype']) ? PostPrefix::format($prefix) : $prefix['name'], 'value' => $prefix_id, 'id' => 'prefix_' . $prefix_id, - 'selected' => $prefix_id == $context['post_prefix_id'] ? true : false, + 'selected' => $prefix_id == $context['post_prefix_id'] ? true : ($prefix_id == $selected_prefix ? true : false), 'data-boards' => '' . implode(',', $prefix['boards']) . '', ]; }