News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Mod authors... Where to begin, you ask?

Started by Daniel15, July 27, 2007, 10:56:54 PM

Previous topic - Next topic

Daniel15

Recently, I've had a lot of people ask me how to code larger mods for SMF. What do I mean by "larger mods"? Well, the way that I see it, there's two types of SMF mods: Small mods, and large mods. Small mods just modify a small section of SMF (say, add a new setting, change how something operates, etc.). On the other hand, large mods are the type of mods that add their own button to the menu bar, have their own Source file, stuff like that. Of course, you've also got massive mods (like SMFShop, SMF Arcade and TinyPortal) which are quite heavy (and have their own modding community... These mods are the hardest to manage and easiest to break :P).

Anyways, most of the time, I point beginner modders to my SMFBlog mod. I intentionally kept the code as simple as possible, so other people can use it as an example. My mod demonstrates the following mod fundamentals:

  • Adding your own action (index.php?action=whatever).
  • Handling subactions (index.php?action=whatever;sa=something.
  • Adding another tab to the Features and Options section of the admin panel.
  • Using SMF templates and subtemplates.
  • Using the "postbox" (the box that people type posts in, with all the BBC buttons) in your own templates.
  • Rewriting URLs to pretty URLs via QueryString.php (in combination with mod_rewrite).
  • Adding an item to the menu in the default theme.
  • Using SMF's template layer system.
  • Adding something to the "linktree".
  • Using SSI functions in mods.

So, if you're stuck, take a look at the Blog.php and Blog.template.php files (as well as the install.xml file), see how they work, and feel free to use any bit of them in your own mods.

Hope this helps all you new mod developers :D. I know that when I first started writing SMF mods way back in 2004, there was very little documentation, and so I needed to guess quite a lot of things (and the code ended up very ugly :P). Now, things have changed quite a bit. There's still a distinct lack of documentation relating to mod development, but we're hoping to fix this. In the mean time, the best way to learn about modding SMF is by taking a look at existing mods, and the SMF source itself :)
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

karlbenson

I can appreciate the amount of effort that goes into coding large mods.  I'm currently half way through re-writing my ad revenue sharing mod.

I have found using the examples in other modifications and indeed even core smf, as a good way to learn how to write good code aswelll as making good smf mods.
And even though I need to refer less and less to others, I will no doubt take a look at blog mod as I'm keen to learn new bits like SSI and making prettyurls.

marcinikj

A big thank you to the mod author.  Looking through the php for this mod has explained more about using template, layers, actions and subactions than anywhere else I have seen.

Eliana Tamerin

Thanks for the help, Daniel. It's nice to see somebody putting forth a resource for mod authors, especially one like this. I never realized how comprehensive the SMFBlog mod actually was, that it covered all those bases. I will certainly have increased motivation to examine its code and how it performs some of these actions.

Thanks!
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

[SiNaN]

Thanks Daniel. Can you or the other experienced mod authors give some key points about adding a specific panel to a mod, not using the ModSettings?
Former SMF Core Developer | My Mods | SimplePortal

Eliana Tamerin

I think his Shop mod is a good example of that.
Do NOT PM me for support.

SimplePortal 2.3.6 is OUT!
SimplePortal Project Manager
Download | Docs
SimplePortal: Power of Simplicity!

[SiNaN]

Not an example I ask for. Just some key points.
Former SMF Core Developer | My Mods | SimplePortal

Dragooon


[SiNaN]

A panel like SMF Shop, SMF Gallery, SMF Arcade has.
Former SMF Core Developer | My Mods | SimplePortal

Dragooon

You mean admin panel?
Why don't you look at the code? Thats the best place to start it.

Deprecated

I can't find any reasonable place to ask my question, and haven't been able to find the answer after days of reading posts...

Just how the heck do you submit a mod once you've written it and tested it?

Aaron

Go to the mod site and click 'Submit New Mod', which is located at the bottom of the page.

Nathaniel

@Deprecated,
If you have any coding related questions or issues, including mods and asking for help in developing or testing a mod then I suggest that you ask in the Coding Discussion Board. I am more than happy to help if you have any issues, as are many other more experienced modders.
SMF Friend (Former Support Specialist) | SimplePortal Developer
My SMF Mods | SimplePortal

"Quis custodiet ipsos custodes?" - Who will Guard the Guards?

Please don't send me ANY support related PMs. I will just delete them.

Deprecated

Aaron, thanks for the info, and yeppers that's the page I needed. In fact the most difficult part of developing my mod was finding the secret page where you submit it. ;)

Really, is that page linked anywhere? I sure can't find any link "which is located at the bottom of the page." Unless I'm blind...

LHVWB, thanks for the tip, been there, done that, got the help! My mod, and it's a pretty small one, is ready to go. Just wondering, it's pretty small and not much to test, and it's about as tested out as I can do by myself. My current version level is 0.5 and I wonder if I should bump that to 1.0 to submit it, or leave it as is?

And okay my mod is really small and I understand it may not get accepted for that reason, which is okay with me. I developed it for myself and I like it just fine, and in the spirit of open source I'm offering it to those who may be interested. That's the most I can do.

But... I will appreciate if somebody would at least give me some feedback, whether upon the format of my package (guidelines etc.), or upon the concept and whether it's a useful function, or even by possibly installing it on a test forum and letting me know if it works okay for you. I have had zero feedback and one download. So if anybody would take a look at any part of my mod before I submit I'll appreciate it. Otherwise I'm done with it, and I'm moving on to developing a bigger mod that I'm almost certain will be well received and will get approved when it's done.

Here's the first mod:

Add IP2Location to Track IP (ver 0.5) -- Requesting critique on my mod package

I'll hold off submitting my mod to the modsite for a while in case I get any feedback, but I'm done with it unless somebody finds issues. Please post in the linked topic above if there is any feedback. Thanks!

karlbenson

Its not a hidden page. Its the MAIN mod page.

Click customize, clicks Mods. which brings you to
http://custom.simplemachines.org/mods/

The link is there.
Mod Developers (in bold). Then has a link to submit a new mod, An example package, and documentation/info link

Deprecated

#15
I told ya, I'm blind! ;) :D

Actually, simplemachines.org is such a huge site, and I've read so, so, so, so many pages and topics and documentation the last few days that I'm almost going blind from so much reading.

It's difficult to not get enthused and involved in such an interesting project. I just started my own SMF based forum less than two weeks ago and the software is GREAT!!! :D

I've never had a forum where I could actually modify the code!

[SiNaN]

Deprecated; you can try setting up a local and coding your mods there.

Also add this code in to your Settings.php file and you will be using the debug mode:

$db_show_debug = true;

What I like most in SMF is, even we regular people can understand what is coded. In other forum softwares, usually, only Developers understand what they code.
Former SMF Core Developer | My Mods | SimplePortal

Deprecated

We regular people? Maybe you are. I'm a bit irregular at times. ;)

Thanks for the suggestion regarding db_show_debug. As far as local server, I had considered that and maybe I might, but I've got a test forum set up on a different URL and different server than my production forum and it's very useful, and for sure will help me keep from goofing and blowing my users offline.

I'm already starting to learn my way around SMF and I've only been looking at the code about a week or less. I'm a professional developer and I'm used to projects about this size, although of course not one person projects. I'd hate to have to write this much code all by myself! :)

SleePy

If you have suggestions for us to improve the layout of our site or any page, please feel free to suggest them in site comments :)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Deprecated

Sleeeeeepy!!! I tole you, I'm blind!  ;)

I'll do better than that. I'm already writing mod packages, and maybe I'll come help you guys write SMF code when I get more familiar with the software base. :)

Advertisement: