Skip to content

Commit aa030bc

Browse files
pre-select a prefix
Signed-off-by: Diego Andrés <diegoandres_cortes@outlook.com>
1 parent e080f92 commit aa030bc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/PostPrefix/Integration/Posting.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,14 @@ public static function post_end() : void
233233
// Add the list of prefixes to the options
234234
if (!empty($context['user_prefixes']['post']))
235235
{
236+
$selected_prefix = (int) isset($_REQUEST['prefix']) ? $_REQUEST['prefix'] : 0;
236237
foreach ($context['user_prefixes']['post'] as $prefix_id => $prefix)
237238
{
238239
$context['posting_fields']['topic_prefix']['input']['options']['PostPrefix_select_prefix']['options'][$prefix_id] = [
239240
'label' => !empty($modSettings['PostPrefix_post_selecttype']) ? PostPrefix::format($prefix) : $prefix['name'],
240241
'value' => $prefix_id,
241242
'id' => 'prefix_' . $prefix_id,
242-
'selected' => $prefix_id == $context['post_prefix_id'] ? true : false,
243+
'selected' => $prefix_id == $context['post_prefix_id'] ? true : ($prefix_id == $selected_prefix ? true : false),
243244
'data-boards' => '' . implode(',', $prefix['boards']) . '',
244245
];
245246
}

0 commit comments

Comments
 (0)