XF 2.2 Why would my add-on not be working?

Wildcat Media

Well-known member
I had a simple add-on that added code to extra.less via a series of a half dozen small template modifications.

For whatever reason, all of those template modifications have disappeared--they are no longer listed among Appearance / Template modifications in the admin menu. The entire add-on no longer appears there.

Digging into the files. Everything is still present in the .json files, but I see that the template_modifications.xml file is now largely empty (nothing but default XF text). I have uninstalled and reinstalled the add-on, and the template modifications no longer appear. I've tried rebuilding with development mode on or off, and still, nothing.

What step am I missing?
 
I have had something similar happen if I install/upgrade the add-on while development mode is active and the add-on folder contains an _output directory that is either incomplete or empty. In development mode, XenForo prefers the contents of _output to the contents of your add-on's _data XML files.
 
I know the feeling. Yet I've tried installing, uninstalling, rebuilding, etc. in and out of development mode and just can't get it to load.

I'm done with messing with it--I'll have to spend an hour or more recreating the addon under a different name, and hope it doesn't get wiped out a second time. Didn't have this issue in the past (prior to 2.2.15).
 
I'm not sure I'd recommend developing an add-on in a production environment. Normally you would build the add-on using the CLI and then install it in production from the control panel.

Nevertheless you can run php cmd.php xf-dev:import -a Your/AddOn to import from the development files and then potentially php cmd.php xf-addon:export to export the data into the XML files properly.
 
I'm not sure I'd recommend developing an add-on in a production environment.
But isn't that how editing phrases, templates, etc. are done, while in development mode, by tying them to an add-on I've created at the command line? Those options are not available otherwise.

Nevertheless you can run php cmd.php xf-dev:import -a Your/AddOn to import from the development files and then potentially php cmd.php xf-addon:export to export the data into the XML files properly.
This is good to know. Thanks!
 
But isn't that how editing phrases, templates, etc. are done, while in development mode, by tying them to an add-on I've created at the command line? Those options are not available otherwise.
Generally add-ons are developed on a separate installation (usually local).
 
This can happen if you use the web-installer while development mode is enabled, and have an _output directory that isn't fully populated.

It is something of a foot-gun.
 
This can happen if you use the web-installer while development mode is enabled, and have an _output directory that isn't fully populated.

It is something of a foot-gun.
This all started when I was tracking down a bug with a third-party style, which wasn't a bug on their side, but an add-on that was causing it to fail. I disabled all add-ons, then re-enabled one by one. Somewhere in there, this simple add-on of mine stopped working.

I've since built a new one, as it turns out some of the template modifications were no longer needed with the new style I chose. It's not a big deal to clean up the JSON files with some regex search-and-replace so I can drop the mods right into a new template modification.

I just wanted to see what happened, and why, so I don't run into this again. I just think that things should be a little more predictable when we are in development mode--I can't be hopping back and forth to enable/disable it every time I do something, as I've done this type of work before strictly in development mode for years and never had issues. But...leave it to me, to break something... 🤣
 
Back
Top Bottom