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

Lack of interest Allow Redirect after Add-on installation



ATM it's not possible to redirect the admin to a page after the add-on installation ( deinstallation).
The Script redirects him automatic to the add-ons page
* Installs a new add-on. This cannot be used for upgrading.
* @return XenForo_ControllerResponse_Abstract
public function actionInstall()
return XenForo_CacheRebuilder_Abstract::getRebuilderResponse($this, $caches, XenForo_Link::buildAdminLink('add-ons'));
It would be cool, if we could define own pages/links here.
For example:
After my gallery intallation, i'd like to redirect the user automatic to the gallery settings page

Or another scenario:
Redirect the user to a form before the addon deinstallation, so he can confirm, if he wants to delete the data or leave them in the database...


Active member
I'm not sure if this is a small feature or a big feature request since I don't know this area of the code well, but it would be handy to have a post installation callback method for addons. To my understanding the flow (roughly) is to run the add-on's stated install method if it has one, then update a bunch of stuff such as templates, phrases, event listeners, etc... It would be nice to have the ability to run another bit of install code after this point.

The idea came about when writing the install code for my NavManager plugin. For the first release I simply created the default navigation tabs which created the templates and phrases for me. Those were then contained in the addon XML file. Now that I'm working on a few bug fixes I've realized that this was a very bad choice to make. I can't keep these templates and phrases in the addon XML as they will wreck havoc on people who are upgrading.

So really what I should have done was create the phrases and templates in the install code rather than bundling them in the XML file. Of course my code depends on some options in admincp which doesn't yet exist. Nor does the code event listener which extends the template model with some helper functions. However, even if I do get this to work (and I have actually) I can't actually use the template datawriter to make templates on the fly during installation (still looking into why).

Now I know that this is sort of an edge case, but I'm sure there will be plenty of other instances were a post install callback would be useful to an addon developer. Also if there is some decent way to do this feel free to call me a fool and point me in the right direction =).



New member
i agree that this would be useful. an addon i'm working on needs to install a new database table and this seems like it would be the right place to put that code.


OK, i checked it now.

Yes, the install callback runs as first.
THen it adds the data from the addon xml
and then it rebuilds the cache.

$db = $this->_getDb();

if ($addOnData['install_callback_class'] && $addOnData['install_callback_method'])
array($addOnData['install_callback_class'], $addOnData['install_callback_method']),

$addOnDw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn');
if ($existingAddOn)
$addOnDw->setExistingData($existingAddOn, true);

$this->importAddOnExtraDataFromXml($xml, $addOnData['addon_id']);
What about an second callback which could be run AFTER the cache rebuild?


XenForo moderator
Staff member
If the thread author is satisfied that the required functionality exists then I'll move this to implemented.


Active member
This functionality does not exist unless something has changed in 1.0.2 that I'm not aware of.

Edit - After looking through the 1.0.2 source I can confirm this hasn't been implemented. Currently the installation/upgrade process for an add-on goes (in a high level way) like this:

1) install_callback_class/method
2) importAddOnExtraDataFromXml
3) rebuildAddOnCaches

For #2 it goes through various pieces of an add-on (templates, admin templates, event listeners, etc...) and first deletes everything associated with the add-on (if it's an upgrade) and then installs (for lack of a better word) the data in the XML.

My suggestion is to add a post_install_callback_class/method in between steps #2 and #3 or possibly after step #3 (I'd have to look into the specifics more). The purpose of this area is not necessarily for database manipulation which should happen in the install callback. It is tangentially related to pre-populating data into a database insofar as perhaps requiring an extended class via a code event listener. It is mainly intended for any add-on which has some dynamic resources which are generated on the fly, perhaps templates, code events, or something else. These sorts of things will be removed in step #2 and need to be added later somehow.

Hope that helps.


Active member
Wish I'd have seen your post before I started editing my post with details, heh. Yes, what I'm suggesting is similar to what you suggested in your post. I also like the idea of being able to redirect someone after the install process has completed, something which I have thought about but apparently never thought about suggesting.

Brogan, if you want you can merge these two threads as they have similar content dealing with suggestions for the install procedure for add-ons.