PDA

View Full Version : youtube links



cooltechie
Sun 18th Jan '09, 4:24pm
We see many http://www.youtube.com/watch?v=XXXXXX.

Is there automated way to fix that? It would certainly take forever if done manually.

phpbb 3.0.4
vbulletin 3.8.0
clean import

Steve Machol
Sun 18th Jan '09, 10:20pm
You can try this unofficial and unsupported BB Code to add a YouTube tag:

http://www.vbulletin.com/forum/showthread.php?t=195897&highlight=youtube+bbcode

bigwater
Mon 19th Jan '09, 2:39am
While some bbcode is supported by vBulletin and some is not, the whole key to wrap your head around bbcode is that you are sandboxing html. You want to give your users the ability to use html in the board, without exposing the board to the risk of html.

You can create any bbcode you want to show on the board, and you can go to any extreme you want to go with it, risk factors aside.

Jerry
Mon 19th Jan '09, 2:04pm
I would suggest replacing



[youtube]


with




[url]

cooltechie
Thu 22nd Jan '09, 7:01pm
You can try this unofficial and unsupported BB Code to add a YouTube tag:

http://www.vbulletin.com/forum/showthread.php?t=195897&highlight=youtube+bbcode

I looked at that thread but it only applies with video ID and not the entire URL. Since all the posts have been imported with full URL, I'm looking for a better solution to get the existing ones working.

cooltechie
Thu 22nd Jan '09, 7:02pm
I would suggest replacing



[youtube]
with




[url]


Already imported from phpbb3, so how can [youtube] be replaced with [url]?

Jerry
Thu 22nd Jan '09, 7:13pm
I'd back up the vBulletin database then run this SQL on it :



UPDATE vb_post SET pagetext=REPLACE(pagetext,"[youtube]","[url]")

cooltechie
Thu 22nd Jan '09, 8:08pm
Sorry, I looked in the database and see that phpbb_posts has youtube listed as this:

[youtube:123abc]http://www.youtube.com/watch?v=wA235SW[/youtube:123abc]

How should I adjust your code?

Jerry
Thu 22nd Jan '09, 8:18pm
Ah, you'll need to use cleaner.php with a regex to clean that out, something like this should do it :



$text = preg_replace('#\[youtube:([a-z0-9]+)\](.*)\[/youtube:\\1\]#siU', '$2', $text);

cooltechie
Thu 22nd Jan '09, 11:03pm
Forgive me. I don't understand how to use the code you provided. Do I paste that into a file?

Jerry
Fri 23rd Jan '09, 1:44pm
You will need to edit, tools/cleaner.php which comes with impex.

Set this to true, when you want to use it, then false afterwards (and remove ImpEx completely when done).



$active = false;



Then around line 98 you'll have this :



#$text = preg_replace('##siU', '', $text);


Replace that with the code I gave you above.

Then browse to the file, and make sure you've back up the vBulletin database first.

cooltechie
Sat 24th Jan '09, 4:38pm
Your detailed information certainly helped out. :D

Thank you Jerry for your assistance with this.

I'm sure I will run into more of these odd post migration issues from phpbb3.

There are other similiar type of issues [blahblah:###]example[/blahblah:###], but I don't know what this is called. What is the best search term to use?

Jerry
Mon 26th Jan '09, 12:41pm
There are other similiar type of issues [blahblah:###]example[/blahblah:###], but I don't know what this is called. What is the best search term to use?

If you don't know what they are called then there is no way of looking for them, you'll just have to spot them as you go along.