Page 1 of 1

Execute function Just after Enable/Disable plugin

Posted: Fri May 29, 2020 6:59 am
by Valkno
Hello.

I have this problem, im coding a plugin and need run a function to modify a sql table, just after (or before) enable or disable the plugin in the admin panel.

I was searching through all the plugin events but did not find any that run on these events...

Do you know of a way to do this?

Sorry for the writing, English is not my native language.

Thanks for read.

Re: Execute function Just after Enable/Disable plugin

Posted: Fri May 29, 2020 7:08 am
by sozzled
onExtensionAfterSave, maybe?

Re: Execute function Just after Enable/Disable plugin

Posted: Fri May 29, 2020 8:13 am
by SharkyKZ
Also onContentChangeState to handle disabling/enabling plugins from plugin list.

Re: Execute function Just after Enable/Disable plugin

Posted: Fri May 29, 2020 10:58 pm
by Valkno
sozzled wrote:
Fri May 29, 2020 7:08 am
onExtensionAfterSave, maybe?
Try this function but when enabling / disabling the plugin it did not run.

Code: Select all

  public function onExtensionAfterSave($context, $table, $isNew)
  {
    JFactory::getApplication()->enqueueMessage('TestMessage');
    $document = JFactory::getDocument();
    $document->addScriptDeclaration('
        console.log("TestMessage");
    ');
  }
SharkyKZ wrote:
Fri May 29, 2020 8:13 am
Also onContentChangeState to handle disabling/enabling plugins from plugin list.
This works but is only launched by enabling the plugin, and not by disabling it.


Any ideas in case this is disabled?

Thank you very much for 2!