Craft CMS Asked on January 13, 2021
I am developing a plugin for craft 3 and the plugin just got published to the store.
I can browse through the store and install the plugin but it stays disabled. The user will have to goto Settings -> Plugins and then manually enable the plugin even after installing. Is there a way to auto enable the plugin after install?
It's because the plugin is doing this in the init()
:
https://github.com/poptins/craftcms-poptin-app/blob/master/src/Poptin.php#L69-L74
That's basically overwriting Craft's default Project Config settings for a plugin (which is to be enabled).
https://github.com/craftcms/cms/blob/develop/src/services/Plugins.php#L536-L545
If you keep it there, then you'll have to explicitly set it to enabled in Project Config as well, but ideally, you'll want to move that logic out of init()
and into something like an EVENT_AFTER_INSTALL_PLUGIN
event.
Answered by Brad Bell on January 13, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP