1

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?

Example

0

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.