How To use YouTube BBcode

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page


Current Release 1.0.4 | | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes

Third part of the e107 handbook
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes

How To use YouTube BBcode

A major change has been implemented on e107 sites in how to embed the videos from YouTube

The ability to add raw code in any form is dangerous and could allow a hacker access to the site so has been updated so that site admin can decide what userclass can actually post html and scripts.

This is set in admin >> Preferences >> Text Rendering. The advice is to restrict it to Main Admin to keep sites as secure as possible.

Site members can still embed YouTube videos with a couple of mouse clicks though.

The first thing to do after upgrading to e107 v0.7.23 and (later versions if upgrading from a pre e107 v0.7.23 release) is Backup your Database then go to admin >> cache and CLEAR your site cache.

Then go to database >> scan plugin directories and run the tool. Next check that the YouTube bcode icon appears on your toolbar in news, content,forums etc.

If it doesn't, check that you don't have an outdated bbcode_template.php file in your theme folder. If it does remove it, or modify it in line with the new one in your themes>>templates directory.

If you have a site that has Video 'embeded' all ready ,changing the script posting restrictions will break them, and you will see a *SANITIZED* message in the script that appears on screen in the forums etc. So there is a nifty conversion tool for admins to run for existing video.

IMPORTANT NOTE: if you have the 'Advanced BBcode' plugin installed, uninstall it before running the fix routine. You can reinstall it afterwards.

Go to: yoursite/e107_files/resetcore/fixyoutube.php and the conversion tool will run and should output a message when completed (It was testedon a site with 200+ embed videos)

This will convert all references to youtube movies to the new bbcode, in the following areas:

- news - submitted news - forum - content

    • Note that this conversion may not be 100% successful, but should convert the bulk of the references **

(It is reasonably straightforward to add additional areas if appropriate i.e. faq etc. - examine the code towards the end of the file).

The next bit is what you might want to explain to site members:-

There is now a new You Tube button youtube.png on the editor toolbar when you 'create new thread' or 'reply to thread'

All you do is put the YouTube video ID code between the tags, with no http url etc. like this:

[youtube]H2BjkL5mJ1[/youtube] (H2BjkL5mJ1 is simply an example)

Its usage is as follows:

[youtube=tiny|small|medium|big|huge or width,height|norel&border&privacy&nofull]ID[/youtube]

where ID is the (currently 11-character) reference of the movie.

To explain a bit more simply:

When you look at a YouTube video you will see a link in the browser bar like this, just copy the code at the end of the link AFTER the = sign

Important: from e107 v0.7.25+ you can enter the full URL [youtube][/youtube] and e107 will do the rest

Then press the YouTube Button to generate the tags:

Then, paste the copied code between the tags:

Please Note: Do not include any & characters in the link code as they are not required and are blocked. This will however, not work for Photobucket videos at this time

Finally press 'Submit Thread'

You can also paste the complete 'embed' link from youtube instead of the ID, in which case the parameters will be extracted to create the correct bbcode. If you specify parameters in the actual bbcode, they will override any pasted from the link.


[youtube small|norel&border&privacy]MnA8mfBn00s[/youtube]

[youtube 480,385]MnA8mfBn00s[/youtube]

[youtube 480,385|border]MnA8mfBn00s[/youtube]

[youtube norel]MnA8mfBn00s[/youtube]