Replace a string in all posts of your forum
#1
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.
Reply
#2
Why ?

Just use "Word Filter" in ACP.
Reply
#3
(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..
[Image: xoa.png]
Reply
#4
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
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#5
(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
Reply
#6
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.
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)