PDA

View Full Version : DataManager: How to delete ALL a user's posts and threads based on userid ?


PleaseHelp
02-21-2012, 01:33 PM
Hello,

How can we replicate the functioning of the "Delete as Spam" feature (where we HARD delete all posts and threads by a specific user) using the DataManager?

Thanks!

GavoTrav
02-21-2012, 01:57 PM
I think delete all posts can only be done via admincp

http://site.com/admincp/thread.php?do=pruneuser&f=-1&u=[USERID]&confirm=1

Be careful with this

PleaseHelp
02-23-2012, 01:27 PM
I think delete all posts can only be done via admincp

http://site.com/admincp/thread.php?do=pruneuser&f=-1&u=[USERID]&confirm=1

Be careful with thisAlthough this seems like it would work, it looks a bit complicated to automate as it would require the script to first log-in to the Admin CP, then run that URL, and finally confirm the deletions.

Is there a more straightforward method for a script ?

kh99
02-23-2012, 02:23 PM
In inlinemod.php there's a section that deletes a users threads and posts when a moderator chooses "delete as spam". The moderator can choose "Delete other posts and threads started by the affected users", and the code for that starts around line 1358:

if ($vbulletin->GPC['deleteother'] AND !empty($user_cache) AND can_moderate(-1, 'canmassprune'))
{


it looks like it just looks up the thread and post ids and creates a thread or post datamanager for each one and calls delete(), but it also does some "verifying" before that, and I'm not sure why or if it's necessary. Also, after all the deleting is done it calls build_thread_counters() for each thread that had posts deleted, and build_forum_counters() for each affected forum. I also see that if a user has more than 50 posts or threads it doesn't try to do a mass delete, and I don't know if that's just a safety measure or if it would fail.

Sorry I don't have a better answer than that for you.

badawidollah
05-26-2012, 01:19 AM
thanks