Create a new thread
is_signed_in()) {
trigger_error('You must be signed in to create a thread.');
exit();
}
?>
validate_post_content($_POST['post_content']);
$thread_subject = $form->validate_thread_subject($_POST['thread_subject']);
$thread_category = $form->validate_thread_category($_POST['thread_cat']);
$form->on_success(function () use ($post_content, $thread_subject, $thread_category) {
$thread_id = Thread::create($thread_subject, $thread_category);
Post::create($post_content, $thread_id, $thread_category);
header("Location: /viewthread.php?id=" . $thread_id);
});
}
?>