1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by Stuart Wright, Mar 2, 2015.

  1. Stuart Wright

    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?

    Last edited: Mar 2, 2015
  2. LPH

    LPH Well-Known Member

    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.
    Digital Doctor, Walter and tajhay like this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    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.
    Talaysen, Daniel Hood, Earl and 2 others like this.
  4. tajhay

    tajhay Well-Known Member

    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.
  5. infis

    infis Well-Known Member

    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.
  6. TheBigK

    TheBigK Well-Known Member

    @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 goddamn 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.
    Coop1979, Earl, tajhay and 4 others like this.
  7. meetdilip

    meetdilip Active Member


    How is Aptana Studio compared to phpStorm ?
  8. NixFifty

    NixFifty Well-Known Member

    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.

    Hello, fellow Brummy. (y)
  9. Jake B.

    Jake B. Well-Known Member

    It's way better IMO! :)

    Also, on topic @Stuart Wright

    Just dig apart other people's add-ons to figure out how things work. If you need help feel free to let me know :)

    - Jake
    Stuart Wright likes this.
  10. Robust

    Robust Well-Known Member

    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.
  11. TheBigK

    TheBigK Well-Known Member

    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 ;)
  12. Stuart Wright

    Stuart Wright Well-Known Member

    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.
    TheBigK likes this.
  13. Robust

    Robust Well-Known Member

    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.
  14. Jake B.

    Jake B. Well-Known Member

    Also, if you have any open source project you can get it for free. Same for if you have a .edu e-mail.
    Robust likes this.
  15. digitalpoint

    digitalpoint Well-Known Member

    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. :)
    TheBigK, Robust and ge66 like this.
  16. TheBigK

    TheBigK Well-Known Member

    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.
    Robust and Earl like this.
  17. Daniel Hood

    Daniel Hood Well-Known Member

    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.
    Dan likes this.
  18. tyteen4a03

    tyteen4a03 Well-Known Member

    If your add-on is open-source or if you are a student, you can get a PHPStorm license for free.
  19. Digital Doctor

    Digital Doctor Well-Known Member

    That's cheap compared to what you've spent on Xenforo.
    Don't be penny wise.
  20. Stuart Wright

    Stuart Wright Well-Known Member

    We spent all the money.
    tyteen4a03 and Digital Doctor like this.

Share This Page