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

Is it possible to enable/disable an addon from another addon?

Discussion in 'XenForo Development Discussions' started by SneakyDave, Nov 4, 2014.

  1. SneakyDave

    SneakyDave Well-Known Member

    I'd like to create a simple cron or addon to disable or enable an addon (chat) at certain dates and times.

    Looking at the xf_addon table, it looks like it would be as simple as setting the "active" column to 0, but after noticing that didn't work, it looks like there is a cache rebuild that needs to happen

    From the AddOn DataWriter
    Is it possible to somehow do this rebuild from an addon, or is that more or less impossible?

    Or is there a better way to disable an addon , I suppose I could set it to display:none in the template, but I bet there'd be a template cache to rebuild after that.
  2. Chris D

    Chris D XenForo Developer Staff Member

    How did you set active to 0?

    You would need to do it using the AddOn DataWriter as that would call the _postSave process that then rebuilds that very cache that needs rebuilding.
  3. SneakyDave

    SneakyDave Well-Known Member

    For the moment, I was just doing an external query, updating the table. Looks like it requires a little more thought than that, obviously. Thanks for the tip
    Chris D likes this.
  4. Chris D

    Chris D XenForo Developer Staff Member

    Wherever possible, always use the DataWriter to make changes. There are often values and caches (as is the case here) that need to be updated and they only going to be triggered when using the DataWriter.
    Daniel Hood and SneakyDave like this.

Share This Page