Deletion advice

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
weedgur79
Registered User
Posts: 305
Joined: Mon Dec 22, 2008 3:58 am
Contact:

Deletion advice

Post by weedgur79 » Sun May 20, 2018 12:41 pm

Is it possible to remove all posts from a forum database which include one specific word?
Or to remove a word from all posts where it appears?

User avatar
GanstaZ
Registered User
Posts: 331
Joined: Wed Oct 11, 2017 10:29 pm
Location: Zverse

Re: Deletion advice

Post by GanstaZ » Sun May 20, 2018 1:23 pm

Everything is possible. Why not censor that word? It's simple and fast, no coding/sql required.

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49172
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Deletion advice

Post by stevemaury » Sun May 20, 2018 1:51 pm

Removing posts directly from the database can cause all sorts of issues. But to answer your question, yes it is possible. Much better would be to change the text of a post containing the word to something like "Deleted". You could do that with this SQL ( Executing SQL Queries in phpMyAdmin )

Code: Select all

UPDATE phpbb_posts SET post_subject = 'Deleted' WHERE post_text LIKE '%the word%';
UPDATE phpbb_posts SET post_text = 'Deleted' WHERE post_text LIKE '%the word%'
Note that this will also change the text of an entire post that quotes a post with the word, to 'Deleted'.

Backup the posts table before running this.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2625
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Deletion advice

Post by thecoalman » Sun May 20, 2018 10:24 pm

stevemaury wrote:
Sun May 20, 2018 1:51 pm

Code: Select all

UPDATE phpbb_posts SET post_subject = 'Deleted' WHERE post_text LIKE '%the word%';
UPDATE phpbb_posts SET post_text = 'Deleted' WHERE post_text LIKE '%the word%'
You need be careful with this if the word is not very specific because %the word%' matches any occurrence, if it were %man%' that matches gasman, postman, oilman and thecoalman. :P It would also match manually and "adcmanabc". Whenever I'm doing any type of wildcard search and replace I will add space before an after. % man %' . That may leave some occurrences like ones on newline or have punctuation afterward but it's not going to wipe out things you do not want to match.

Do a search afterward and clean up the rest manually if there is not many of them.

User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 49172
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Deletion advice

Post by stevemaury » Mon May 21, 2018 2:44 pm

Good point. You can also put a space before and after.

What IS "the word"?
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. PM or email me.

All unsolicited PMs will be ignored.

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: bryan23, ge0rdie, Matthew_Greg, Noxwizard and 20 guests