I want to learn to code addons for Xenforo. I have specific experience, where do I start?

Stuart Wright

Well-known member
Given that I started computer programming 35 years ago, you'd think I'd find it a doddle to pick up Xenforo coding.
But it's also 15 years since I resigned from my last programming job and started AVForums full time.
So Xenforo coding is very different to what I've been used to.

What I do know:
Basic PHP. Never used classes.
MySQL. Quite comfortable with queries.
CSS. Picked a lot of that up sorting AVForums out.
I managed to create and release a whole addon for vBulletin. That was easy.

What I don't know:
MVC. Don't even know what it stands for.
What things like classes, controllers and listeners are or do.
Javascript, JsQuery or any stuff like that.
A whole load of things I don't know I don't know.

From here, at the bottom of the mountain, it seems such a steep learning curve that I can barely face starting.
But I know I have to. I desperately need to learn this so I can code for AVForums without spending money we don't have.

Ideally Mike, Kier or Chris would come here and teach me how to do it. Stay for a week in the spare room.
Currys here in Birmingham are wicked.

But failing that, where do I start?

Thanks.
 
Last edited:
Listed in the order for fastest learning ....

Build a test environment (MAMP, XAMP, etc) with PHP, MySQL
Install XenForo
Install Chris D's add-on installer
Install phpStorm

Using phpStorm, start looking through the installation/library/ files to get a feel for the files
Install an add-on of your choice
Look at the directory structure

Start your own project
Read some of the tutorials in the development forum

Get stuck - and search with phpStorm and ask in the development forum.
 
I found actually having a reason for learning the code was the best motivation.
So have something in mind as a very basic add-on.

One of the most basic things you can do is a new tab on the navigation bar.

Once you have that working, try adding an option for it, then a permission.

Then go from there.
 
Im in the same boat. I know ABAP (SAP) programming like the back of my hand, but have no idea when it comes to programming in PHP or Xenforo. Would like to learn as well. Thanks for the tips guys.
 
Best for programming - IDE with debug. My choice is NuSphere PhpEd. It can debug on remote server through SSH, for example.
For manage database I use dbForge Stuido for MySQL.
I learned from video tutorials on this site and simple add-ons. Also, I still continue to learn on the quality add-ons.
For test and change CSS I use Google Chrome tools and Mozilla Firefox FireBug.
 
@Stuart Wright - We are in the same boat. As Brogan said, you need to have a solid reason to actually make some progress. For me, it was the frustration which was a result of spending months and months in finding developer and repeating the entire process when they left projects mid-way. But I'm really happy that I started.

I began by first installing phpStorm (highly recommended), loading up basic addons and then spending hours just looking at the code. It actually took me ~3 months before things began making sense. I was able to code a basic addon by the end of 4th month and at a stage now where I can do very basic stuff on my own. It feels great. But be prepared for a long and frustrating journey - and I'm not saying that to discourage you.

Since we're in the same boat, I'd say -
  1. Buy phpStorm (and I'm not their spokesperson)
  2. Read up basic stuff about PHP and MVC. This won't make sense in the first go; but do it anyway.
  3. Repeat step #2 till you start understanding how a class is different from an object and what M,V and C do.
  4. Start with the tutorials listed here: https://xenforo.com/community/resources/how-to-create-a-cron-entry-to-move-threads-with-options.317/
  5. It took me about 20 revisits ( no kidding) to those tutorials before I could really figure out what's going on and 'why'.
  6. Ask questions on the forum. If you're lucky - you'll find an angel to help you out. Usually it'll be Chris or Brogan. But they'll only provide clues; you will still have to explode your brain to understand what they are hinting at.
  7. Ask questions again.
  8. ...and again.
  9. ......and again.
  10. Refer to this excellent addon created by Kier: https://xenforo.com/community/threads/scratchpad-demonstration-ajax-add-on.8369/ for how Kier does it.
  11. Get frustrated. But don't give up.
  12. Code you first ******* addon.
  13. Show it to everyone.
  14. Now everything makes sense. You can now understand Kier's addon - minus the JS part.
  15. Feel the need to learn JavaScript. Realise that your ultimate aim is to understand jQuery.
  16. Feel pumped up!
I'm at #16 - and desperately looking for tutorials.

PS: I must acknowledge the help and motivation offered to me by @Mr. Goodie2Shoes . He's been a really awesome guy who answered dumbest of my questions with patience.
 
MVC. Don't even know what it stands for.
What things like classes, controllers and listeners are or do.
Javascript, JsQuery or any stuff like that.
A whole load of things I don't know I don't know.
MVC stands for Model View Controller. You'll probably want to read up on MVC and also Object Orientated Programming (OOP) to get a basic gist of how XenForo does what it does. When you cover OOP, you'll learn what classes are (amongst other things) and what they can do. MVC will teach you about controllers (also amongst other things) and reading up on both while looking at XenForo's code will really showcase a lot of those ideas and patterns in a real-world scenario.

Learning JavaScript and jQuery will help a fair bit but it really depends on what you want to do. For some instances, you may not even have to write a line of JavaScript.

Currys here in Birmingham are wicked.
Hello, fellow Brummy. (y)
 
I'd agree with phpStorm, but only because I come from an IntelliJ background and this is pretty similar. Honestly, use whatever IDE you're comfortable with. LPH and Brogan give easier ways to start. The tabs thing (while it's very basic if you're just adding a little tab to the navigation) can teach you quite a lot if you mess around with it, even if you're adding redundant features to it, you could learn the basics of various aspects. Honestly, before reading about MVC and OOP I'd just dive in heads first and do what Brogan suggested. I followed that advice and it got me bored out. I couldn't understand a thing, and at least for me the best way to learn is to get some hands on experience, then take a look at MVC and OOP and it'll make much more sense since you've visited it already and used it in a practical sense. You'll have to learn it down the way, but I wouldn't make reading the first thing you do. There are some nice development tutorials too in the resource manager.
 
@TheBigK

How is Aptana Studio compared to phpStorm ?
I may not be the right person to answer that question because phpStorm is my first 'real' IDE. It's more than what I'd have asked for and I think it's worth every buck you spend on it. Has saved me lot of time checking the methods, their implementation, declaration et al. I guess any sophisticated IDE offers that. If you do not want to spend money on IDE; you should be good to go with Eclipse PDT as well. I think that was the first IDE that I installed. But then I found so many phpStorm fans here. I thought I'd just mimic what others are doing. I remember Chris mentioning that Mike uses phpStorm as well ;)
 
phpStorm £157. Not cheap. Started the learning curve with finding out what IDE means :)
Have used Dreamweaver to date as we have the complete Adobe package, though we didn't jump on the subscription package, so we're stuck on CS5.5.
 
phpStorm £157. Not cheap. Started the learning curve with finding out what IDE means :)
Have used Dreamweaver to date as we have the complete Adobe package, though we didn't jump on the subscription package, so we're stuck on CS5.5.
Email them saying you're learning PHP and want to use their IDE as it looks great and they'll give you a nice offer. I did, and it was just total honesty since I didn't have their price, and they gave me more than 60% off. Dreamweaver isn't a PHP IDE, and it's hardly even a good web design software.
 
phpStorm £157. Not cheap. Started the learning curve with finding out what IDE means :)
Have used Dreamweaver to date as we have the complete Adobe package, though we didn't jump on the subscription package, so we're stuck on CS5.5.

Email them saying you're learning PHP and want to use their IDE as it looks great and they'll give you a nice offer. I did, and it was just total honesty since I didn't have their price, and they gave me more than 60% off. Dreamweaver isn't a PHP IDE, and it's hardly even a good web design software.

Also, if you have any open source project you can get it for free. Same for if you have a .edu e-mail.
 
As others have said, you should have something specific you want to create vs. just wanting to learn it for sake of learning it. When there's something you actually need to do, there's better motivation to figure it out.

This is the tutorial that got me squared away with XF programming: https://xenforo.com/community/threads/creating-an-addon.5416/

Coming from building vBulletin add-ons, I remember at first I was like, "Duh what? Maybe I'm too dumb for this."... but pretty quickly you get over that hump and a giant lightbulb goes off in your head. Now I feel like I lose about 50 IQ points anytime I have to go back and look at vBulletin add-on code. :)
 
I remember at first I was like, "Duh what? Maybe I'm too dumb for this.".
That's quite motivating for me :) . I guess you were already well versed with PHP and JavaScript; and all you needed to understand the 'XF way' of doing stuff. For me, it's learning everything: PHP, MVC, JS and trying to implement what I study.

I'm still looking for some help / pointers that'd help me understand how XF uses jQuery and JS.
 
phpStorm £157. Not cheap. Started the learning curve with finding out what IDE means :)
Have used Dreamweaver to date as we have the complete Adobe package, though we didn't jump on the subscription package, so we're stuck on CS5.5.
Get NetBeans to start; it's free and not terribly different (although I prefer phpstorm like most other people and have spent the money on the license and find it worth it).

I like the method @LPH stated, download something and look at how it's done. I recommend looking at the resource manager or gallery (as they were coded by the devs and therefore, logically, follow the standards you should learn).

Also makes sense to have a project in mind like others have said.
 
  • Like
Reactions: Dan
Top Bottom