MyBB Community Forums

Full Version: MySQL query: How to delete [URL] tags?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have just converted my phpbb3 forum to mybb.

I'm trying to delete all instances of url links in my forum. Is there a SQL statement that can clean out all links from all the posts.

I used this statment to remove the signature :

UPDATE mybb_users SET signature='';

But i need someting for the posts.

Alternatively is there anything like the impex_cleaner for vBulletin.

Any help would be appreciated.
I am still desperate to find a solution. I found this statement vb forum :

UPDATE post SET pagetext = REPLACE(pagetext, '[URL="http://www.example.com"]Spam Site | Buy our spam![/URL]', '');

Can someone with more knowledge about mybb table structure modify the above query to work with mybb.

Please.....
faviouz or Dylan would be the ones to talk to....or Pirata
that is essentially correct, but it will only replace one specific set of links that use the [URL] tag. There are plan links not in a tag (just an http:// or https://) and then the links that are in a [URL=XXX] type tag as well.

Then all the other possible URLs and link text combos. Do you want to remove a specific link or all links?

I am not very good at regex and i think that MySQL supports it, but not if it supports within a REPLACE function
I would like to remove all links.

i have tried the following code which manages to remove the begining. But i would like some kind of wild card expression to remove everything between the [URL=] and [/url]

UPDATE mybb_posts SET message = REPLACE(message, '[url=', '');
two ways

1) write a PHP script to clean and update one post a time (preferably with looping in batches to keep from timing out)

2) adding a custom function to MySQL and using that in an update query. see http://techras.wordpress.com/2011/06/02/...for-mysql/
Those solutions are bit too complex for me. So i have settled for removing the links but keeping the link text. I run the following sql query :

UPDATE mybb_posts SET message = REPLACE(message, '[url=', '');
UPDATE mybb_posts SET message = REPLACE(message, '[/url]', '');
UPDATE mybb_posts SET message = REPLACE(message, ']', ' ');
UPDATE mybb_posts SET message = REPLACE(message, 'http://www.', '');

To avoid future link abuse i have used a plugin to restrict posting links until the user has made 10 posts.

Thanks for your help.
the problem with the third line is that you remove all ending brackets for all tags.

also, those queries do not capture any https:// or any [url] versions (no link text)