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

Execute code when add-on enabled or disabled

Discussion in 'XenForo Development Discussions' started by Arty, Oct 14, 2012.

  1. Arty

    Arty Well-Known Member

    I'd like to execute small piece of code when my add-on is being enabled or disabled. Add-on isn't being installed/uninstalled, so installation function doesn't help.

    Is it possible?
  2. Chris D

    Chris D XenForo Developer Staff Member


    It might be possible by extending the add-on controller but that in itself requires an add-on which would need to be installed.

    How come your add on isn't being installed or uninstalled?

    Another way is to run a cron job that checks the status of the add on and then run the action depending on its outcome.

    Depends how quickly that action needs to occur as to whether that's going to work.
    Arty likes this.
  3. Arty

    Arty Well-Known Member


    Its situation when you check "Enable / Disable" box in add-ons list. It doesn't uninstall, it just disables add-on.

    edit: problem solved. I've found a workaround for my problem (forcing user to reload css when my add-on is disabled/enabled) that doesn't require executing anything
    Chris D likes this.

Share This Page