$title = str_replace('{1}', $user->username, $title);
$title = substr($title, 0, 150);
// FORM TO NEW THREAD
if ($form->inthread && $forum = $form->Forum)
{
$watch = false;
$poster = $form->getPoster($user);
if ($poster === $user && $form->watchthread)
{
$watch = true;
}
$threadParams = [
'title' => $title,
'message' => $message,
'threadPrefixes' => $threadPrefixes,
'watch' => $watch,
'forum_node' => $forumNode,
'attachment_hash' => $attachmentHash,
'create_poll' => true
];
$thread = $this->createThread($poster, $forum, $form, $user, $threadParams);
$title = str_replace('{ID}', $thread->thread_id, $title);
$title = substr($title, 0, 150);
$thread->title = $title;
$thread->save();
}