Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2015, 11:34 AM
postcd postcd is offline
 
Join Date: Feb 2012
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vbulletin delete all posts containing phrasse

Hello,
as an vbulletin 4.2.x admin, how can i easilly delete all forum posts which contains certain phrasse like for example "API Payment." on entire forum, all users. When i search for that phrasse it shows threads, but i want to be able to somehow in bulk delete posts containing that phrasse. Thank you
Reply With Quote
  #2  
Old 06-09-2015, 01:00 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you can find the posts you want via a search then you can delete them from the search results page. Use "Search Single Content Type" and select "Show Results as posts".

But I guess you can't search for phrases or words 3 letters or less. In that case I'm not sure if there's any way to do it in vbulletin, but you could use a query to change the database directly (which is dangerous - you at least want a backup before doing it). Maybe a good way to do it would be to insert rows in the moderation table, then use the existing post moderation to delete them. If you're interested I can post a query to do it.
Reply With Quote
  #3  
Old 06-10-2015, 06:19 AM
postcd postcd is offline
 
Join Date: Feb 2012
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks alot kh99,
The vBulletin Search you recommended worked but search engine is very limitted, it do not index some words, dont allow too short ones.. If you could share the mysql quesry You talk about it would be very beneficial!

In case of vB search, one can see 25 posts per page and can tick them all and bulk delete them.

If one want to see like 200 posts per page, try to go to: AdminCP -> Settings -> Options -> Message Searching Options and modiffy "Maximum Search Results to Return" and "Search Results Posts Per Page" options

Mysql query You mentioned would allow faster SPAM removal in case one want to search numerous SPAM phrasses and want to delete more than 200 posts at a time (it appears search dont want to return more). If it is simple for you, it would be nice to know that mysql query which would move posts matching phrasse into moderation queue.

All moderated threads can be then deleted in bulk via: AdminCP / Threads & Posts / Prune , there is option to delete Moderated threads.
Reply With Quote
  #4  
Old 06-10-2015, 06:52 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by postcd View Post
Mysql query You mentioned would allow faster SPAM removal in case one want to search numerous SPAM phrasses and want to delete more than 200 posts at a time (it appears search dont want to return more). If it is simple for you, it would be nice to know that mysql query which would move posts matching phrasse into moderation queue.

All moderated threads can be then deleted in bulk via: AdminCP / Threads & Posts / Prune , there is option to delete Moderated threads.
I tried something like this:

*removed*

[S]And it seemed to work, but I only did one small test, so use at your own risk [/S](and always have a recent backup).

Edit: Oh, actually I just realized that if a post is the first in a thread, then the type needs to be 'thread' instead of 'reply', and that will take a more complicated query. I'm not sure what will happen if the type in the moderaton table is 'reply' but it's the first post.
Reply With Quote
  #5  
Old 02-11-2016, 11:22 AM
postcd postcd is offline
 
Join Date: Feb 2012
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It seems that my search index do not index all posts or there is some search results cache that not got prunned, because there are still plenty of posts vbulleltin search cant find so i cant delete post based on the phrasse (example phrasse: "Memo: API"). Any solution please?

PS: my "Search Index Minimum Word Length" is 4 isnt that case?, but i dont want to have huge index
Reply With Quote
  #6  
Old 11-13-2017, 03:48 PM
postcd postcd is offline
 
Join Date: Feb 2012
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So there is no other way to delete more than 200 posts in one go?
I need to delete 90724 posts having phrase news.google.com in them (they are leading thread posts, and some of these threads have replies)
Now the posts are made by one user but he no longer exist as he has a Guest status and message "Invalid User specified." appears.

I have another theory on how to solve this:
Quote:
create new user, copy its userid and then run mysql query which will find all posts that i want to delete (contains certain phrasse) and then modify these mysql entries userid's to match new user userid, and then delete this user via admincp.
In MySQL db i see:

SELECT * FROM `post` WHERE `pagetext` LIKE '%news.google.com%'
i found 2 users which have matching posts:

username: username1, username2
userid: 479, 0
pagetext: %news.google.com%

username2 had userid 308

SELECT * FROM `thread` WHERE `postusername` LIKE 'username1' AND `postuserid` LIKE '308' AND `replycount` LIKE '0' AND `notes` LIKE 'Imported thread'
This found posts i want to delete.

UPDATE `thread` SET `postuserid` = '308' WHERE `postusername` LIKE 'username2' AND `postuserid` LIKE '308' AND `replycount` LIKE '0' AND `notes` LIKE 'Imported thread'
is wrong

Please any idea on right mysql query?

I found:
UPDATE table1 dest, (SELECT * FROM table2 where id=x) src
SET dest.col1 = src.col1 where dest.id=x ;
but does not work
Reply With Quote
  #7  
Old 11-14-2017, 07:52 AM
Seven Skins's Avatar
Seven Skins Seven Skins is offline
 
Join Date: Sep 2008
Location: London, UK
Posts: 1,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try searching for userid = 0

e.g SELECT * FROM post WHERE userid='0'
Reply With Quote
  #8  
Old 11-14-2017, 11:26 AM
postcd postcd is offline
 
Join Date: Feb 2012
Posts: 319
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, i find 182240 entries, but many are valid and i do not want to delete these, i can return only those i want to delete, but still, this may cause damage to the vbulletin db when i delete them? Instead in my previous post i mentioned theory to change just userid of these posts to a new user and then delete this user via admincp, but i do not know right mysql query. I assume query would have to be run both for post and thread table and maybe also other table/s in order these posts really change its owner.
Reply With Quote
  #9  
Old 11-15-2017, 01:57 AM
CAG CheechDogg's Avatar
CAG CheechDogg CAG CheechDogg is offline
 
Join Date: Feb 2012
Location: Riverside, California USA
Posts: 1,080
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try this ....

Add a new plugin ...

Product = vBulletin

Hook Location = postbit_display_complete

Title = choose something you can remember

Execution Order = 5

Plugin PHP Code

Code:
$word = array(  
'/news.google.com(?= )/',  
'/news.google.com(?= )/',
'/news.google.com(?= )/',  
);  

$changedword = 'what-ever-you-want-it-changed-to';  

$post['message'] = preg_replace($word, $changedword, $post['message']);

This will change news.google.com to what ever you want it changed to instead of deleting thousands of posts and potentially messing something up ...


You can always disable this plugin and everything will go back to it's original state ....
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:18 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.10077 seconds
  • Memory Usage 2,240KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete