Skip to content

Commit

Permalink
pre-select a prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Diego Andrés <diegoandres_cortes@outlook.com>
  • Loading branch information
DiegoAndresCortes committed Jan 7, 2023
1 parent e080f92 commit aa030bc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/PostPrefix/Integration/Posting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']) . '',
];
}
Expand Down

0 comments on commit aa030bc

Please sign in to comment.