MyBB Community Forums

Full Version: [rel] youtube mybb code for 1.2
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
this isn't a plugin more like a howto use a 1.2 feature.
  • open up admin cp
  • scroll to message filters and open up custom mycode.
  • put in a title and description for the code.
  • put this
    \[\youtube\](.*?)\[/youtube\]
    in the 'regular expression' box.  this will yield [youtube] as the bbcode to distinguish the video.
  • put this
    <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>
    in the 'replacement' box.  this is the basic embedd url for a video with the video id replaced with $1, which is the string for whatever is between the mybb code.
example and how to use:
http://wiifantastic.com/showthread.php?tid=139

i don't know how to make it into an actual plugin or how to put a button into the top of the post header thing.  If anyone could fill me in on that, that would be cool.
ahhhh you just forgot one thing the replacement code should be:
<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>
you forgot the $1
it was there, just [code] snuffed it out :'(
CraKteR posted this in the other thread.
I made it diferent.

I did:

\[\youtube\](.*?)\[/youtube\]

just as you did.

But then I went to word filter and created:

 
word:   watch?v=
substitute:   v/

and then I changed all the url´s to $1:

<object width="425" height="350"><param name="movie" value="$1"></param><embed src="$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object> 

This way, all the user needs to do is to copy/paste the video url and
don´t need to separate the "http://www.youtube.com/" from it.
It will be more pratice.
About the youtube button at the header top:
1.Go to:
[/inc/functions.php]
Find:[ "editor_title_close_tags", ]
Add After:[ "editor_title_youtube", ]

2.Go to:
[/inc/languages/english/global.lang.php]
Find:[$l['editor_title_close_tags'] = "Close any open MyCode tags that you currently have open"; ]
Add After:[$l['editor_title_youtube'] = "Add an in-line Youtube Video clip"; ]

3.Go to:
[ In Directory/jscripts/editor.js]
Find: [ {type: 'button', name: 'php', sprite: 'php', insert: 'php', title: this.options.lang.title_php}, ]
Add After: [ {type: 'button', name: 'youtube', sprite: 'youtube', insert: 'youtube', title: this.options.lang.title_youtube} ]


Where the sprite should be youtube´s logo name without the .gif/png/jpj extension;

It won´t make a youtube logo appear, but a new "B" button, like bold one.
If somebody figure out how to change it for youtube´s logo, tell me.
This will make the new B buttom insert "[youtube][/youtube]" on the textbox.

Hope it helped a little.