MyBB Community Forums

Full Version: Delete a specific phrase from all posts ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I just recently converted my vB Forum to MyBB. The attachments all didn't work. I am working now to re-add all of them manually again.

Unfortunately in many threads where in vB were attachments inline, i do have that [ATTACH]25[/ATTACH] for example, different numbers for the old attachments.

Deleting all that by hand is a pain in the a**. Is there a quicker way to get rid of all those ?
You could try something similar to this; http://community.mybb.com/thread-75581-p...#pid551861
(2010-08-09, 12:50 PM)Polarbear541 Wrote: [ -> ]You could try something similar to this; http://community.mybb.com/thread-75581-p...#pid551861

I found that thread before I posted, but this a replace. I am not sure if there is something going wrong or f*** up if I try to replace something with nothing, because in my case I want to get rid of it, not replace it.

Someone knows how to specifically do that with MySQL ? Unfortunately i am not that much into SQL to do all those comments. Really need to know before I can try it.
Just update it with a blank space or something it should work. Obviously though as said in the other post make sure you back up your posts.
Ok, but even if this works, it will only go for the phrase [ATTACH] but what about the various numbers between the old tags, since they are continuosly counting according to the number of old attachments. How do I get rid of those as well without having to single handed delete them ?
Once they aren't in the posts you can goto Forums & Posts --> Attachments --> Find Orphaned Attachments and the attachments (files) will be removed Smile
I did that just now, and I deleted all the old attachments, but unfortunately that doesn't change the fact that attachments that were added "inline" in my previous vB Forum, still show up like for example:

Quote:[ATTACH]43[/ATTACH]

And trying to delete with that replace command via MySQL the phrase "[ATTACH]" oder "[/ATTACH]" will not let me get rid of the different numbers between the old tags.
UPDATE `mybb_posts` SET `message` = REPLACE(message, '[ATTACH]%[/ATTACH]', '') WHERE `message` LIKE '%[ATTACH]%[/ATTACH]%'; 

This might work % is a MySQL wildcard. But don't forget that backup Toungue
Quote:0 row(s) affected. ( Query took 0.0128 sec )
UPDATE mybb_posts SET message = REPLACE( message, '[ATTACH]%[/ATTACH]', '' ) WHERE message LIKE '%[ATTACH]%[/ATTACH]%';

Thanks, but unfortunately that didn't work out.

Here is a example how it looks what I mean.

http://img340.imageshack.us/img340/7206/y24.png
I found that you can search in PhpMyAdmin for text in tables. It found the things I was looking for, and i could then delete them. But in the end, it deleted all the threads contents.

I had a backup of course.

But that way it seems also not to work.
Try to delete them from the atatchments table in the db instead. But first back it up and then run this query at your phpmyadmin.

DELETE FROM mybb_attachments WHERE aid = x; 

Replace x with the attachement is that you want to delete and if your db tables use another prefix other than the default mybb_ then you should use that instead when running the queries.
Pages: 1 2