PDA

View Full Version : Delete Threads and posts


AudioFX
09-20-2007, 05:41 PM
Hi There
I was wondering if anyone knew the sql statement to delete a thread, all posts assigned to the thread, and to remove the post count from members who posted in the thread. I need to completely remove the thread as if it never existed. I'm not sure of the tables I need to adjust, and was hoping to get some advice before I use trial and error ;)
Thank you for any suggestions

Paul M
09-20-2007, 05:43 PM
Just delete it using the normal vbulletin delete thread function.

AudioFX
09-27-2007, 11:56 AM
Thanks for the reply Paul. Can you give me the function name and arguments?

Lynne
09-27-2007, 02:14 PM
I believe he's talking about going into the thread you want to delete and clicking on the Thread Tools bar above the first post and then selecting Delete Thread. You may then click Physically Remove and the then the thread and all the posts will be deleted forever.

Dismounted
09-28-2007, 05:21 AM
You would use the datamanager. Simply call the Thread Datamanager, call "set_existing". And finally, call "delete".

AudioFX
09-28-2007, 05:29 AM
You see i'm using a 3rd party hack, downloadsII to be exact. When a new file is uploaded, a new thread is automatically created in a specific forum. If the user then decides to delete the file from their account, then I need to need to delete the thread that was automatically created. This would be achieved using an SQL statement or even better, a delete thread function as Tom M suggestion. Essentially I need to "physically delete the thread".

Dismounted, how would I use the datamanger to delete the thread? I do not understand what you mean by "calling the Thread Datamanager".

Dismounted
09-28-2007, 06:13 AM
$thread = fetch_threadinfo($threadid);

$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_SILENT, 'threadpost');
$threadman->set_existing($thread);
$threadman->delete(false, true, NULL, false);
unset($threadman);

AudioFX
09-28-2007, 06:30 AM
Awesome, thanks a lot Dismounted! I'm gonna try this out this evening. :)