MyBB Community Forums

Full Version: Developing MyBB Plugins (Ah, I see...)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Starting Out

I found it very frustrating when I first started coming around MyBB forums because it seemed like there were so many things that I just couldn't find an answer for. As I progressed in the learning process it became more and more clear that the problem was dual in nature.

MyBB is still getting a handle on its success and its documentation (though good) can still use a lot of work, but mostly my particular problem stemmed not from lack of information about MyBB, but lack of general web programming knowledge.

The people that visit MyBB forums regularly can help you with all kinds of problems, but if you haven't taken the time to familiarize yourself with the process of creating web pages then you are doomed for failure.

People will get tired of answering all your questions.

Where To Start
  • HTML

    It might sound sarcastic, but too many people are trying to write PHP plugins and can't successfully render valid HTML because they don't understand the markup language.
     
  • JavaScript

    Might as well say jQuery. Get on the bandwagon and pick up some scripting. Practice on static pages and then try some more advanced techniques.

    For the here and now, Prototype is nice to know- especially if you learn well from reading others code.
     
  • CSS

    I personally don't design very well, so consequently, I try to design as little as possible and focus on functionality. If you are creating interface visible on the forum or even Admin CP menus you need to think of the poor eyes of the people that will to use that ugly mess.
     
  • MySQL/MySQLi

    Get object-oriented database techniques under your belt before you even try to embark on anything more than a very simple, test plugin.
     
  • PHP

    Once you have an understanding of all of the previous techniques (and more) the back-end code will begin to make more and more sense.
     
  • AJAX

    Learn how to communicate with the server from the front-end and your life will become easier. Standard AJAX classes in both jQuery and Prototype make this much easier.

Now What

Now you have an understanding of how web design works (or maybe you already did and skipped to this part :p ), you can begin to investigate the framework that MyBB has put together.

Anyone that has spent any time at all will recognize that the developers have made quite a nicely designed package and is ready for extension and capable of improvement quite easily. It may seem at first like people don't want to share their knowledge with you, but some of these things are really hard to tell someone in a forum post.

Look at plugin code that does something that you want to do. Adapt that code and make it work like you want it to (respect licensing!)-- that will teach you a lot in itself.

Start inspecting MyBB Documentation and Searchable Source Code. Follow index.php, through global.php and init.php and learn what is happening on every page before you try to get specific with your plans. Try to evaluate how the MyBB developers have built this system-- how it is strong and how it could be made better . . . let that knowledge find its way into your code.

When you see something wrong with your code, don't avoid it-- fix it. Right then, back up what you have and tear it apart until it works correctly. Every character you add to bad code is time you could've spent writing good code.

A Quick Note About PluginLibrary

(2013-04-14, 07:19 PM)Shade Wrote: [ -> ]When you feel confident enough about writing plugins, you should consider strengthen your knowledges and go further. Other than the "official" PHP functions MyBB's developers have written down, there's an useful library you should really take a look at.

PluginLibrary is a collection of many functions specifically developed for MyBB which simplify the most common aspects of MyBB plugins. frostschutz, its author, has written down a detailed documentation available in the downloadable package. With it, for example, you can create and delete a template or a stylesheet with a single line of code, rather than writing, let's say, 5 lines with complicated SQL queries.

But What Do I Write

Do you run a forum? Then write plugins that do things that you need, but can't find a plugin for. There is no need for a bunch of redundant plugins (although competition is a good thing), create something unique, even if it is simple.

Not an admin? Write a plugin that adds functionality you would like to see as a member.

I'm Stuck!

If you can't seem to make it through the project you have chosen then maybe you need to start a little smaller. In fact, I generally keep several projects open at once because blasting at one thing all the time makes my head hurt.

Balance your moods. If you are creating a serious and complex plugin that people are gonna love and it has you all stressed swap over and create a simple, fun little plugin to get your mind off things . . . or just walk away. Taking a little time away from the computer in general is a good idea.

I think I will do that now. Big Grin

Cheers,
Wildcard
Excellent way to start off for newcomers.
(2013-04-12, 07:25 PM)crazy4cs Wrote: [ -> ]Excellent way to start off for newcomers.
I'd also advise newcomers to try something new. I mean, if you're excellent at creating statistical plugins, why not try something different and add a MyCode through the parser?
A mention of PluginLibrary might be nice too Smile Otherwise, good work on the guide.
Thanks guys.

As far as plugin library is concerned, I guess the reason I have mentioned it as that I still have never written anything with it-- Blush

It would be hard for me to recommend it considering I have no experience using it.
You should Smile Feel free to add this snippet to your first post.

A quick note about PluginLibrary

When you feel confident enough about writing plugins, you should consider strengthen your knowledges and go further. Other than the "official" PHP functions MyBB's developers have written down, there's an useful library you should really take a look at.

PluginLibrary is a collection of many functions specifically developed for MyBB which simplify the most common aspects of MyBB plugins. frostschutz, its author, has written down a detailed documentation available in the downloadable package. With it, for example, you can create and delete a template or a stylesheet with a single line of code, rather than writing, let's say, 5 lines with complicated SQL queries.
Done. Smile

Thanks Shade +1