Skip to content

Commit e6276fb

Browse files
use the correct form for this post field, and separate the logic some more
Signed-off-by: Diego Andrés <diegoandres_cortes@outlook.com>
1 parent 7b6be09 commit e6276fb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

Sources/PostPrefix/Integration/Posting.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ public static function post2_start(array &$post_errors) : void
8787
// Get the real board, user might be posting from the post action only
8888
$real_board = !empty($board) ? (int) $board : (isset($_POST['board']) ? (int) $_POST['board'] : 0);
8989

90-
// With a prefix set, there's nothing to do here, or if this board isn't in the settings for requiring prefixes
91-
if ((isset($_POST['id_prefix']) && !empty($_POST['id_prefix'])) || !in_array($real_board, explode(',', $modSettings['PostPrefix_prefix_boards_require'])) || (!isset($_POST['prefix_istopic']) && !empty($_POST['prefix_istopic'])) || !allowedTo('postprefix_set'))
90+
// Is this a topic or you don't have permission to set a prefix?
91+
if (!allowedTo('postprefix_set') || !isset($_POST['prefix_istopic']))
92+
return;
93+
94+
// Requiring prefixes for this board?
95+
if ((isset($_POST['id_prefix']) && !empty($_POST['id_prefix'])) || !in_array($real_board, explode(',', $modSettings['PostPrefix_prefix_boards_require'])))
9296
return;
9397

9498
// Verify that the user can't set a prefix
@@ -257,12 +261,13 @@ public static function post_end() : void
257261

258262
// Additional hidden input, so we now that this is a topic
259263
$context['posting_fields']['prefix_istopic'] = [
264+
'label' => [
265+
'html' => '',
266+
'text' => '',
267+
],
260268
'input' => [
261-
'type' => 'hidden',
262-
'attributes' => [
263-
'name' => 'prefix_istopic',
264-
'value' => 1,
265-
]
269+
'html' => '<input type="hidden" name="prefix_istopic" value="1">',
270+
'type' => '',
266271
],
267272
];
268273
}

0 commit comments

Comments
 (0)