View Full Version : Delete Thread From Code
LeaderGL
06-13-2006, 08:07 PM
Hi, do you know how can i delete a thread from an external script? (also using vB API).
[OFF TOPIC] Do you, also, know how modify a post? [/OFF TOPIC]
regards,
LeaderGL
tgreer
06-13-2006, 08:19 PM
I believe you'd use DataManagers (http://www.vbulletin.com/docs/html/data_managers) for this. Perhaps someone who has posted about datamanagers in the private Coders Discussion would be willing to step over here and provide some insight?
LeaderGL
06-13-2006, 08:26 PM
do you have some code example on how to delete thread?
tgreer
06-13-2006, 08:40 PM
Not that I've written and tested, no. However, the editpost.php file contains this code:
$threadman =& datamanager_init('Thread', $vbulletin, ERRTYPE_STANDARD, 'threadpost');
$threadman->set_existing($threadinfo);
$threadman->delete($foruminfo['countposts'], $removaltype, array('userid' => $vbulletin->userinfo['userid'], 'username' => $vbulletin->userinfo['username'], 'reason' => $vbulletin->GPC['reason'], 'keepattachments' => $vbulletin->GPC['keepattachments']));
unset($threadman);
LeaderGL
06-13-2006, 08:43 PM
ok, and how i create $threadinfo and $foruminfo ?
i've threadid to delete...
tgreer
06-13-2006, 08:50 PM
Yep, that's the question! I don't have a good answer... I'm exploring this at the same time as you. I'd start by carefully looking at the code in editpost.php. Start at line #982.
Maybe threadid is all you need?
Looking at "class_dm_threadpost.php", there is a "delete" function for threads. You can see the signature for that function on line 1182 of that file. It looks like you can just set the $threadid variable for the thread you want to delete.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.