• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 Post content replace broken links

teletubbi

Well-known member
#1
I have a lot of old post from vb where the bbcode is broken.
Don't know why this was happened.

Here is such a link.

"http://www.pattayaforum.net/gallery/showimage.php?i=xxxxx"][ IMG ]http://www.pattayaforum.net/gallery/files/1/0/0/2/9/xxxxx.jpg[ /IMG ][ /URL ]

And here another.

"http://[URL]http://www.pattayaforum.net/gallery/showimage.php?i=171655"]

As you can see the trailing [ url ] is missing or gibberish .

This results that the post don't look good anymore.

Screenshot_2016-07-12-08-33-39-028.jpeg

And sometimes the pictures are not seen at all.
Even it is the same code. But produce only a link at the post.

It is also not related to picture links alone.
Have other links, extern and intern, where this happens also.

"http://ersuhotel.com/"[ / U R L ]

Here the trailing url missing as well.

In other post from same date everything is working as expected.
So don't understand why sometimes the code is broken and sometimes not.

Anyhow i like to repair the link for the pictures.

So replace the first part "http://www.pattayaforum.net/gallery/showimage.php with [ url ] "http://www.pattayaforum.net/gallery/showimage.php

How to do it?
 

Brogan

XenForo moderator
Staff member
#2
You can do simple replacements using a query like so:
Code:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');
Something like that would enable you to replace e.g. "http with [URL="http.

For more complex replacements, which may require some sort of regex (for non similar patterns), you would have to use this add-on: https://xenforo.com/community/resources/post-content-find-replace.1549/

Ensure you take a backup of the post table before running any queries on it.
 

teletubbi

Well-known member
#3
The addon i have.
But as i don't really now the syntax there it doesn't help me much.

I will look with the query.
But why sometimes the link start wit 'http and sometimes with "http.
 
#7
You can do simple replacements using a query like so:
Code:
UPDATE xf_post SET message = REPLACE(message,'current_content','new_content');
Something like that would enable you to replace e.g. "http with [URL="http.

For more complex replacements, which may require some sort of regex (for non similar patterns), you would have to use this add-on: https://xenforo.com/community/resources/post-content-find-replace.1549/

Ensure you take a backup of the post table before running any queries on it.
This helped me a lot! Thanks.

Robert