vBulletin 3.6.x disable YouTube autoplay

February 14th, 2011 | by |

Feb
14

If you have defined a bbcode like [yt]VIDEO_ID[/yt], you’re in trouble. Now your users can pass the new autoplay options calling [yt]VIDEO_ID&autoplay=1[/yt]. When you have 5 or more videos on a page, that’ s really a problem :)

To avoid this just force autoplay to 0 when parsing your bbcode :

--- class_bbcode.php.orig	2011-02-14 03:05:22.000000000 -0300
+++ class_bbcode.php.fixed	2011-02-14 03:05:47.000000000 -0300
@@ -378,6 +378,9 @@
 	{
 		global $html_allowed;
 
+		// Avoid autoplay on bbcodes
+		$text = preg_replace('/autoplay=1/i', 'autoplay=0', $text);
+
 		$this->options = array(
 			'do_html'    => $do_html,
 			'do_smilies' => $do_smilies,

Authored by

Just Me. If you have something to say, please leave a comment somewhere :)

  • Delicious
  • Facebook
  • Digg
  • Reddit
  • StumbleUpon
  • Twitter

Leave a Comment