XF 2.0 Lets Build an Add On. Running SQL Queries?

Brad Padgett

Well-known member
I'm trying to learn how to create an add-on. (I have no php experience as of now. I know html and css. That's it). But the object oriented approach doesn't seem as complicated as I would of thought after looking at the xf 2 docs.

I got all the way to "extending the forum save process". I completed that and then noticed when it says you can test it by checking the box in the node forum and saving it.

When I do that I get an error that relates to setup.php

After doing some viewing of the docs over again in that area I noticed it says "be sure to run your own sql queries". I take it this means placing the setup.php code is not enough. I've never done this before so I'm not exactly sure how to run the SQL queries needed.

What does it take to complete this step? The error relates to the \XF\AddOn\AbstractSetup not being valid in the class extension.

I tried to import the data into the database thinking that was the reason with the development import command and it came up the development mode wasn't enabled. Yet I clearly enabled development mode and debug mode as it shows in the _output directory's json files in PHPstorm that the code event listeners were active as well as the class extension.

So basically simple question though i made it seem complicated for the XF2 devs to understand. The simple question is how to I get the table columns from the php file setup.php to affect the database? Since it said you could test it I didn't finish the tutorial and export the add-on. Do I need to finish the tutorial before the table data can be altered?

Thanks.
 
Guys I found out the same day it was because my xampp wasn't being opened "as administrator" on Windows 10. So far so good. I've made the portal page and I'm at the point of trying to get the threads to feature. I will post an update later tonight if I have any problems setting it up or if I'm able to finish the xf 2 docs tutorial. It's a really great tutorial. Some of you all should try it out sometime. I'm learning a lot.

EDIT: Okay guys I got it to work!

Now I'm going to study the code and try to create my first add-on. Thanks!
 
Last edited:
Back
Top Bottom