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

XF 1.5 Parsing [video] bbcode from old phpbb install

#1
Before upgrading to XenForo, i was using an old phpBB install where members had to use [video] bbcode to embbed youtube links.
So now, the videos aren't displayed anymore on the forum, instead the posts have just the youtube video link between [video] tag

I know i could easily use search and replace to remove the [video] bbcode. Usually XenForo would automatically replace youtube link with the embbed video, but the problem is that the youtube URL are displayed as a string in the posts and NOT a link, so it just look like this in the posts:
Code:
[video]http://www.youtube.com/watch?v=JToC6l9Xx_c[/video]
any idea how to fix this ?

thanks
 
#3
You should be able to use this add on to find posts containing that format and use a regular expression to fix them:

https://xenforo.com/community/resources/post-content-find-replace.1549/
Not sure if i understand what you mean... Like i said i know i can search and replace to remove old [VIDEO] bbcode, but the video URL are parsed as a string and not a link with proper tags... So if i use this addon to remove the old bbcodes, how do i parse URL to convert them to embbed videos ?
 
#5
Code:
Example usage to convert from [video="http://www.youtube.com/watch?v=ZSW4LDAHIeU"]Video title here[/video] to[media=youtube]ZSW4LDAHIeU[/media]:

Quick Find:
[video

Regular Expression:
#\[video=youtube;([^\]]+)\]([^\[]+)\[/video\]#siU

Replacement String:
[media=youtube]\1[/media]
This example from the thread is a good start, but the problem is that my tags from phpbb are like this:
Code:
[video]url[/video]
and not like this:
Code:
[video="url"]title[/video]
Regex is not easy stuff and i'm not sure what is the correct regular expression to use :(
 

Chris D

XenForo developer
Staff member
#6
This will work as long as all of the tags are in that exact format:

Quick find:
Code:
[video]http://www.youtube.com/watch?v=
Regex:
Code:
\[video\]http:\/\/www.youtube.com\/watch\?v=([\w\-]+?)\[\/video]
Replace:
Code:
[MEDIA=youtube]$1[/MEDIA]
 
#7
Thanks for the reply,
The problem is that i can't predict what's inside the [video] tag. Sometimes it's a standard youtube link, sometimes it's a different syntax with additional parameters, in other posts it's a shortened youtu.be link, sometimes it's a dailymotion video or vimeo, etc...

XenForo seems to be automatically detecting the video host when posting a video URL with embedded link. If i remove all [video] tags from the posts using search and replace, then only the raw URL string will be left in the posts... From there, isn't there a way to trigger XenForo parsing functions to automatically convert URL to links which will then become embbed videos ? Just like if the original posters would have simply posted the raw URL in the post, without [video] tags
 

Tracy Perry

Well-known member
#9
Odds are you would need to enable more specificity in your regex for each of the URL's you are wanting to change.
You WILL need to know what the URL's are, which will require some research of the old site DB on your part to ascertain this.
A simple SQL query of the old DB post tables for the [video] string should work to get that information.
 
#10
Since free support is almost non-existant here (again) i offer to paypal $10USD to whoever gives me a working regex to convert old [video] tags to XF bbcode, including videos from youtube (all url variants), vimeo and dailymotion.