MyBB Community Forums

Full Version: Replace a string in all posts of your forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Warning: Always backup your database first in case something goes wrong.

If you need to replace some word or name in all posts of your forum, run this query:

UPDATE mybb_posts SET message = REPLACE(message, "Old String", "New String")

You may want be selective and add a WHERE field=Etc if you only want to replace that string in certain posts, or in a given timeframe.

Remember to be careful when using queries and always double check what you are doing.
Why ?

Just use "Word Filter" in ACP.
(2012-07-17, 08:25 PM)Frank.Barry Wrote: [ -> ]Why ?

Just use "Word Filter" in ACP.

I agree with this, the reason being its easier and you don't have to do it everytime someone makes a new post..
but it works great if you change domains and want to update old links or the admin's username and want to swap out the old ones, etc

plus the query can be used for other fields/tables during development or major changes
(2012-07-17, 09:46 PM)pavemen Wrote: [ -> ]but it works great if you change domains and want to update old links or the admin's username and want to swap out the old ones, etc

plus the query can be used for other fields/tables during development or major changes
Or you could just word filter your old url to your new one
and the word filter already runs for every post on every pageview and you want to add to it for something that can be easily handled via a replace query?

word filter is not a permanent solution, it is a band-aid primarily for censorship of bad words. if you need a permanent replacement, why not use one?

I personally have an option to disable the word filter as we adults can handle the bad language normally filtered for guests.