MyBB Community Forums

Full Version: Can I "replace" links in a specific thread?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have one thread that is over 50 pages, full of Youtube links.

We moved over from SMF 1.1.14 to myBB and some of the links didn't get properly embedded.

Can I do a SQL query to replace that link shown below to the correct link to properly embed it?

The format here:

[url=http://www.youtube.com/whatever]Whatever[/url]

we want to change this to:
[video=youtube]http://www.youtube.com[/video]

_OR_ auto-embed at that top link if it's a Youtube link?

If so, can you tell me where and how? (it would save hours of editing posts)

Thanks!
Hawkeye-X
You can add the latter idea as a MyBB code. I've not done something similar, but if you use a preg_match() php function to check if the website is a youtube website, and replace it with the embedded HTML code you could use that in future.

Otherwise, is the youtube code on a FEW posts? You could make an external PHP script which would automate the process, and then edit the new code into the old post.
(2011-08-04, 07:05 PM)xdario Wrote: [ -> ]You can add the latter idea as a MyBB code. I've not done something similar, but if you use a preg_match() php function to check if the website is a youtube website, and replace it with the embedded HTML code you could use that in future.

Otherwise, is the youtube code on a FEW posts? You could make an external PHP script which would automate the process, and then edit the new code into the old post.

Wow, all of that has flown over my head.. can you help out with this?


similar issues have been resolved earlier with the SQL queries (example) ; please use search feature..
[/quote]

(2011-08-04, 07:13 PM)ranjani Wrote: [ -> ]similar issues have been resolved earlier with the SQL queries (example) ; please use search feature..

I might be wrong, but SQL LIKE queries don't support multiple wildcards, right? I would have suggested a direct SQL query, but unaware of methods to do it directly.

(2011-08-04, 07:11 PM)Hawkeye-X Wrote: [ -> ]
(2011-08-04, 07:05 PM)xdario Wrote: [ -> ]You can add the latter idea as a MyBB code. I've not done something similar, but if you use a preg_match() php function to check if the website is a youtube website, and replace it with the embedded HTML code you could use that in future.

Otherwise, is the youtube code on a FEW posts? You could make an external PHP script which would automate the process, and then edit the new code into the old post.

Wow, all of that has flown over my head.. can you help out with this?

Do you need it to turn the code into the new format once, or do you want it to always be available?

If it's only once, are there a lot of posts, or only a few that need fixing?

(2011-08-04, 07:13 PM)ranjani Wrote: [ -> ]similar issues have been resolved earlier with the SQL queries (example) ; please use search feature..

I might be wrong, but SQL LIKE queries don't support multiple wildcards, right? I would have suggested a direct SQL query, but unaware of methods to do it directly.

(2011-08-04, 07:11 PM)Hawkeye-X Wrote: [ -> ]
(2011-08-04, 07:05 PM)xdario Wrote: [ -> ]You can add the latter idea as a MyBB code. I've not done something similar, but if you use a preg_match() php function to check if the website is a youtube website, and replace it with the embedded HTML code you could use that in future.

Otherwise, is the youtube code on a FEW posts? You could make an external PHP script which would automate the process, and then edit the new code into the old post.

Wow, all of that has flown over my head.. can you help out with this?

Do you need it to turn the code into the new format once, or do you want it to always be available?

If it's only once, are there a lot of posts, or only a few that need fixing?
[/quote]

A one-time shot thing, replacing the malformed links to the correct links.

I have checked, and it's always the url= thing on all of them.

Could someone tell me how to auto-embed the youtube links?
You might wanna give automedia plugin a try.

http://mods.mybb.com/view/automedia

This way, you users can also continue posting the way they used to Wink
You rock, - G33K -. That was the answer I was seeking. Smile