Execute function Just after Enable/Disable plugin

For Joomla! 3.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
Valkno
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri May 29, 2020 6:47 am

Execute function Just after Enable/Disable plugin

Post by Valkno » Fri May 29, 2020 6:59 am

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.

 
User avatar
sozzled
Joomla! Exemplar
Joomla! Exemplar
Posts: 9296
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Execute function Just after Enable/Disable plugin

Post by sozzled » Fri May 29, 2020 7:08 am

onExtensionAfterSave, maybe?
https://www.kuneze.com/blog
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?” :)

SharkyKZ
Joomla! Ace
Joomla! Ace
Posts: 1759
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: Execute function Just after Enable/Disable plugin

Post by SharkyKZ » Fri May 29, 2020 8:13 am

Also onContentChangeState to handle disabling/enabling plugins from plugin list.

Valkno
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri May 29, 2020 6:47 am

Re: Execute function Just after Enable/Disable plugin

Post by Valkno » Fri May 29, 2020 10:58 pm

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!

 

Post Reply

Return to “Joomla! 3.x Coding”