vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   DataManager: How to delete ALL a user's posts and threads based on userid ? (https://vborg.vbsupport.ru/showthread.php?t=278936)

PleaseHelp 02-21-2012 01:33 PM

DataManager: How to delete ALL a user's posts and threads based on userid ?
 
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

Code:

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

Quote:

Originally Posted by GavoTrav (Post 2301944)
I think delete all posts can only be done via admincp

Code:

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

Although 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:

PHP Code:

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


All times are GMT. The time now is 10:05 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01075 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete