$messageId = $parts[2]; $comment = new Phorum_message($messageId); if (!$comment->exists()) { continue; } switch ($value) { case "inbox": $comment->setStatus(PHORUM_STATUS_HOLD); break; case "hide": $comment->setStatus(PHORUM_STATUS_HIDDEN); break; case "delete": // Not allowed to delete first post. if ($comment->getMessageId() != $comment->getThreadId()) { $comment->delete(); ArticleComment::Unlink(null, null, $messageId); } break; case "approve": $comment->setStatus(PHORUM_STATUS_APPROVED); break; } $subjectStr = Input::Get('f_subject_'.$messageId, 'string', '', true); $comment->setSubject($subjectStr); $commentStr = Input::Get('f_comment_'.$messageId, 'string', '', true); $comment->setBody($commentStr); } } camp_html_goto_page("/$ADMIN/comments/index.php");
function testUpdateThreadInfo() { // Create thread start. $message = new Phorum_message(); $message->create(1, 'delete me'); $messageId = $message->getMessageId(); // add message to the thread. $message2 = new Phorum_message(); $message2->create(1, "delete me", "wow", $messageId, $messageId); $message->fetch(); $threadCount = $message->getNumMessagesInThread(); $message2->delete(); $message->fetch(); $threadCount2 = $message->getNumMessagesInThread(); if ($threadCount != ($threadCount2 + 1)) { $this->fail("Thread stats not updated correctly."); } }
/** * This function should be called whenever an article is deleted. * * @param int $p_articleNumber * @param int $p_languageId * @return void */ public static function OnArticleDelete($p_articleNumber, $p_languageId) { if (!is_numeric($p_articleNumber) || !is_numeric($p_languageId)) { return; } $threadId = ArticleComment::GetCommentThreadId($p_articleNumber, $p_languageId); // Delete all comments for this article $threadHead = new Phorum_message($threadId); $threadHead->delete(PHORUM_DELETE_TREE); // Delete all links to this article. ArticleComment::Unlink($p_articleNumber, $p_languageId); } // fn OnArticleDelete