Hello, I use a php script in the page addThread.php that looks like this:
I have googled around to find that code. Now I need to create the deleteThread.php which does the reverse thing. Given the id of a discussion/thread, how can I remove it? I want to remove the main post and all the sub posts made by the users.
THanks a lot
PHP:
<?php
require('../src/XF.php');
XF::start('../');
$forumId = " "
$userId = " "
$title = " "
$message = " "
$forum = \XF::em()->find('XF:Forum', $forumId);
$user = \XF::em()->find('XF:User', $userId);
\XF::asVisitor($user, function() use ($forum, $title, $message)
{
$creator = \XF::service('XF:Thread\Creator', $forum);
$creator->setContent($title, $message);
$creator->setPrefix('1'); //Prefix ID # to set new thread as.
$creator->setIsAutomated();
$creator->save();
});
?>
I have googled around to find that code. Now I need to create the deleteThread.php which does the reverse thing. Given the id of a discussion/thread, how can I remove it? I want to remove the main post and all the sub posts made by the users.
THanks a lot