MyBB Community Forums

Full Version: How to add a MyCode to a MyBB Forum???
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello People,

I have created a forum using MyBB and now I want to add the ability of inserting youtube videos into my thread/post creating box.

I have found two custom MyCodes in these forums for this purpose..

but......

I am very sorry to say that I have no Idea about how to add any one of them to my forum.

I have found a page in my Admin Panel which I think is the page where a new MyCode should be defined. it's screenshot is this:

Please check it and first of all tell me that am I on the right page???
If yes, then please give me details on how can I insert any one of the MyCodes posted here to my own forum.

And if it is not the right page then please refer me to the correct place and then give me the instructions.

I shall be very thankful to you!!!!!!!
Yes, you are in the right place in the screen shot. My particular code is a bit different, it's customized slightly to have a spoiler for YouTube vids, but you can change a couple things to make it work as regular.

Title can be whatever you want.

Short Description isn't needed.

Under "Regular Expression" I have:

\[ytspoil\]http\://(www\.)?youtube\.com/watch\?v=([^"'[]+?)\[/ytspoil\]

Under "Replacement" I have:

<div style="margin:20px; margin-top:5px"><div class="quotetitle"><input class="button2 btnlite" type="button" value="YouTube Spoiler" style="text-align:center;width:115px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';      this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }" /></div><div class="quotecontent"><div style="display: none;"><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$2"></param><embed src="http://www.youtube.com/v/$2" type="application/x-shockwave-flash" width="425" height="350"></embed></object></div></div></div>

Now again, this is slightly modified so there's a spoiler tag for the vids. And where it says "[ytspoil\]" in Regular Expression you can change the "ytspoil" to anything you want, like maybe "youtube" so when users enter [youtube] tags, it'll work like that.

Someone else might have the basic YouTube code handy...

EDIT: here's a thread right under your about YouTube myCode http://community.mybboard.net/thread-60543.html
DO you have to active mycodes I am kind of in the same boat?
(2009-12-08, 12:29 AM)windowsmediaman Wrote: [ -> ]DO you have to active mycodes I am kind of in the same boat?

Yes you do. Otherwise it won't be "active". You can always deactive or delete if it happens not to work as you want.