Every time I make a news post on my CMS, I want to make a new thread in the forums.
My knowledge of Xenforo is quite limited, just downloaded the software last week, but I have found snippets of code on these forums that allow me to do this.
However, when I delete a news post or set it to unpublished, I want to soft-delete the thread, so I can restore it when a news item is published again.
It looks like I need to change the discussion_state from "visible" to "deleted". But how to do that within the XF framework?
As far as I understand, doing
Also, I figured out how to get all the thread information and make a reply, but how do you get all the replies within a thread for a particular thread ID?
Thanks!
My knowledge of Xenforo is quite limited, just downloaded the software last week, but I have found snippets of code on these forums that allow me to do this.
However, when I delete a news post or set it to unpublished, I want to soft-delete the thread, so I can restore it when a news item is published again.
It looks like I need to change the discussion_state from "visible" to "deleted". But how to do that within the XF framework?
As far as I understand, doing
Deletes the thread entirely?$thread = \XF::em()->find('XF:Thread', $threadID);
$thread->delete();
Doesn't work$thread = \XF::em()->find('XF:Thread', $threadID);
$thread->setDiscussionState('deleted');
Also, I figured out how to get all the thread information and make a reply, but how do you get all the replies within a thread for a particular thread ID?
Thanks!