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

Need some help with media bbcode


Active member
Hello, everyone!

I would like to add a custom bbcode. When entering the following bbcode:

[video] video id [/video]

I should see the video player plus a message "ID: video id" under the player.

I know I have to edit the Base.php file, but don't really know what code I should use.


<embed src="http://----.com/?v={$id}"></embed>
<br />
<b>ID: {$id}</b>
As you can see, the first {$id} displays the player and the second {$id} outputs the ID in plain text.

See screenshot



Jake Bunce

XenForo moderator
Staff member
You can add to the existing [media] BB code:

Admin CP -> Home -> BB Code Media Sites

Look at the existing media sites for code examples. It's fairly straight forward. Once you add your media site then you can use code like this in your post:


Or you can click the Screen shot 2010-11-05 at 9.19.04 AM.png icon in the editor and paste the full URL.

edit - here are some media sites people have added:



Active member
That would work for new posts, but will take some time to edit 50k posts to reflect the new bbcode.

The existing bbcode is [video] [/video]

Do you know how I could update all the existing posts at once?


Jake Bunce

XenForo moderator
Staff member
A string replacement query might work for your purposes:

UPDATE xf_post
SET message = REPLACE(message, '[video]', '[media=youtube]')

UPDATE xf_post
SET message = REPLACE(message, '[/video]', '[/media]')

Backup first.