Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
BBInsertBar: how to add a new button
I have added YouTube support to my forum as in this post: http://lussumo.com/community/discussion/3942/embed-youtube/
Now I would like to add a button or some kind of link to the posting area, so people can easily embed their videos.
Can anyone advise?
0
This discussion has been closed.
Comments
default.php
function Parse($String, $Object, $FormatPurpose) { $parser = new HTML_BBCodeParser(); if ($FormatPurpose == FORMAT_STRING_FOR_DISPLAY) { $String = $this->ProtectString($String); $String = $parser->qparse($String); $String = preg_replace('/\<youtube\>(.+?)\<\/youtube\>/', '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>', $String); return $String; } else return $String; }
bbcodeparser.php:
'youtube' => array( 'htmlopen' => 'youtube', 'htmlclose' => 'youtube', 'allowed' => 'all', 'attributes'=> array()),
[ youtube ] (videoID) [ /youtube ]
without the spaces of course ...where the video ID is the bit at the end of a youtube link.
All it did for me was display the video ID as plain text...
I used:
[youtube]ElrldD02if0[/youtube]
Does that work for you?
default.php
After line 32ish
$Context->Dictionary['bbsmilie'] = 'Insert Smilie';
Add, do NOT replace!$Context->Dictionary['bbyoutube'] = 'Insert YouTube Video';
After line 67ish
if ($this->Context->Configuration["BBBAR_DISABLE_VANILLACONS_BAR"] == TRUE) echo "<a onclick=\"insertBBSmilie()\"><img src='".$this->Context->Configuration["BASE_URL"].$this->Context->Configuration["BBBAR_PATH"]."buttons/text_smilies.gif' alt='".$this->Context->GetDefinition('bbsmilie')."' title='".$this->Context->GetDefinition('bbsmilie')."' /></a>";
Add, do NOT replace!echo "<a onclick=\"insert('youtube','/youtube','".$this->Context->Configuration["BBBAR_DISABLE_VANILLACONS_BAR"]."')\"><img src='".$this->Context->Configuration["BASE_URL"].$this->Context->Configuration["BBBAR_PATH"]."buttons/text_youtube.gif' alt='".$this->Context->GetDefinition('bbyoutube')."' title='".$this->Context->GetDefinition('bbyoutube')."' /></a>";
I think that just about covers it, but as I haven't got this working my end and I can't code PHP or JS yet, I'm shooting in the dark.
P.S. I still want that ZIP file you know, I want this to work for me and all
Anyway, it's 0126 and I have work later at 0900 so that's not a job for now but later :P zzzzzzzZZZZZZZZzzzzzzzzzzzzzzzzzzzzz