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

XF 1.2 display media after vbulletin import

Mr Lucky

Well-known member
#1
Is there a way that e.g. youtube videos will display after an import from vbulletin without having to edit each post individually?

Thanks
 

Mr Lucky

Well-known member
#3
Are they attempting to be displayed with BB Code with add-ons such as ame for vBulletin?

Sorry, I'm not sure what that is. The vbulletin forum i am importing from is v4.2 and has no media addons

In the imported forum, the post just shows the code like this:

Code:
[video=youtube_share;gQV8yReZQY8]http://youtu.be/gQV8yReZQY8[/video]
If I edit it to:

Code:
[media=youtube]gQV8yReZQY8[/media]
Then it displays as embedded video rather than just code:

 

Adam Howard

Well-known member
#4
Back up your database first, but the quick and easy way to do this would be to run this command in MySQL (or phpMyAdmin)

PHP:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
 

Brogan

XenForo moderator
Staff member
#6
Back up your database first, but the quick and easy way to do this would be to run this command in MySQL (or phpMyAdmin)

PHP:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
That won't work for the opening tag as it is formatted like this:
[video=youtube_share;gQV8yReZQY8]

Not to mention you are trying to replace 'youtube' and the string is 'video'.

That will require regex due to it containing the video ID.
Use this tool: http://xenforo.com/community/resources/post-content-find-replace.1549/
 

Mr Lucky

Well-known member
#7
Back up your database first, but the quick and easy way to do this would be to run this command in MySQL (or phpMyAdmin)

PHP:
UPDATE xf_post SET message = REPLACE(message, '[youtube]', '[media=youtube]');
UPDATE xf_post SET message = REPLACE(message, '[/youtube]', '[/media]');
That doesn't seem right. The current imported code=

Code:
[video=youtube_share;gQV8yReZQY8]http://youtu.be/gQV8yReZQY8[/video]
And has no [youtube] or [/youtube]
 

Mr Lucky

Well-known member
#9

Yes, I have installed that but am a bit confused as there are (at least) two different formats of the embed:

Code:
[video=youtube;g0uAlX9RSEI]http://www.youtube.com/watch?v=g0uAlX9RSEI[/video]
or

Code:
[video=youtube_share;gQV8yReZQY8]http://youtu.be/gQV8yReZQY8[/video]
Will that RegEx work for both?

NB: this question is now at two threads as I asked over on the Post Replacement Tool Thread so my apologies for sort of cross posting. I am concerned to get this right as I get the feeling if it's wrong it gets really complicated, though of course the database is backed up.