MyBB Community Forums
Replace a string in all posts of your forum - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: Tutorials (https://community.mybb.com/forum-38.html)
+--- Thread: Replace a string in all posts of your forum (/thread-122749.html)



Replace a string in all posts of your forum - Sector - 2012-07-17

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.


RE: Replace a string in all posts of your forum - Frank.Barry - 2012-07-17

Why ?

Just use "Word Filter" in ACP.


RE: Replace a string in all posts of your forum - Ariana - 2012-07-17

(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..


RE: Replace a string in all posts of your forum - pavemen - 2012-07-17

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


RE: Replace a string in all posts of your forum - Kaleb M - 2012-07-18

(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


RE: Replace a string in all posts of your forum - pavemen - 2012-07-18

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.