How to Embed YouTube Videos to phpBB via bbCode Shortcode

How to Embed YouTube videos in bulletin board software such as phpBB, which will not allow you to use the embed code provided by YouTube.

By Tim TrottPHP Tutorials • December 10, 2009
How to Embed YouTube Videos to phpBB via bbCode Shortcode

Embed YouTube videos in bulletin board software such as phpBB, which will not allow you to use the embed code provided by YouTube.

This simple tutorial will show you how you and your visitors can link embed youtube videos in posts with a very simple bbcode tag. This tutorial is aimed at phpBB version 3, although a similar technique may be used for SMF.

PhpBB 3 features a new custom BBCode tag editor which allows you to create custom tags. Here is how it is done.

First, log into your Administrative Control Panel (ACP) and click on the Posting tab on the top menu.

Embed YouTube in phpBB posts
Embed YouTube in phpBB posts

Click the "Add a new BBCode" button in the bottom right-hand corner. (Note: The "youtube" item as shown in the photo below, won't appear at this point on your forum - we are going to create it)

How to Add YouTube Videos to phpBB
How to Add YouTube Videos to phpBB

Enter the following code into the "bbcode usage" box:

[youtube]{SIMPLETEXT}[/youtube]

Enter the following in the "HTML replacement" box. This is essentially the embed code from the YouTube page. Notice the video id has been replaced with {SIMPLETEXT}.

xml
<object width="425" height="350">
  <param name="movie" value="http://www.youtube.com/v/{SIMPLETEXT}&amp;hl=en_US&amp;fs=1&amp;"></param>
  <param name="allowFullScreen" value="true"></param>
  <param name="allowscriptaccess" value="always"></param>
  <embed src="http://www.youtube.com/v/{SIMPLETEXT}&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="350"></embed>
</object>

Finally, enter this code into the helpline text box:

Insert YouTube Video ID# - Example: [youtube]Hue_h4nsi[/youtube]

You can check "Display on posting page" to add a button to the posting page.

Click submit and that is now done.

How to Add YouTube Videos to phpBB
How to Add YouTube Videos to phpBB

You can simply embed a YouTube video by using

[youtube]AixMDvKuxqU[/youtube]

Where AixMDvKuxqU is the video id from the YouTube URL.

How to Add YouTube Videos to phpBB
How to Add YouTube Videos to phpBB

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

My website and its content are free to use without the clutter of adverts, popups, marketing messages or anything else like that. If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

This post has only 1 comment. Why not join the discussion!

New comments for this post are currently closed.