Converting youtube clips embedded with BB-code to xF

DoctorWatsOn

Well-known member
Before vB introduced youtube embedding, I was using BB-code and when I imported my vb4 data into xF it didn’t convert these, so posts just show:

[youtube]xp9Gm-aRe5A&hl[/youtube]
OR
[YOUTUBE]it-gPAhFq1c[/YOUTUBE]

Is there anyway these can be converted to make them display?
 

Brogan

XenForo moderator
Staff member
You can run some SQL queries to update the post table.

Code:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
Make sure you take a backup first....just in case.
 

bambua

Well-known member

steven s

Well-known member
I'm going to need this too.
If only there was a way to bookmark these posts for future use. (Other than saving bookmarks with your browser.)
 

DoctorWatsOn

Well-known member
You can run some SQL queries to update the post table.

Code:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
Make sure you take a backup first....just in case.
Will that work, because the [youtube] tags only include the video ID, whereas xF's [ media=youtube] tags use the whole URL?
 

Brogan

XenForo moderator
Staff member
I'm going to need this too.
If only there was a way to bookmark these posts for future use. (Other than saving bookmarks with your browser.)
Why not update the BB Code and the post table on your forum now?

That's what I've done so when it comes to switching I won't need to update anything.
 

Brogan

XenForo moderator
Staff member
whereas xF's [ media=youtube] tags use the whole URL?
Once you add the URL, the software strips out everything except the video ID.

For example, I just added this using the media button on the editor and this is the result:
[media=youtube]8gFgs_To9GY[/media]
 

Brogan

XenForo moderator
Staff member
Is this easier than running the SQL queries?

Not that I know how to do either. :oops:
Well you will have to run the queries whether you do it on your current database or after you convert as all of the historic post content will have to be updated.

I just prefer to get as much done beforehand so there is less to do after I switch.
 

Ray

Active member
You can run some SQL queries to update the post table.

Code:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
Make sure you take a backup first....just in case.
That works the best.
Make sure you run both for youtube and YOUTUBE
 

DoctorWatsOn

Well-known member
Well you will have to run the queries whether you do it on your current database or after you convert as all of the historic post content will have to be updated.
Oh right, I'll put that on the 'to do list' for my techie before we do the live site upgrade, thanks again.
 
Top