Answers.Body: <p>It's because the plugin is doing this in the <code>init()</code>:</p>
  <p><a href="https://github.com/poptins/craftcms-poptin-app/blob/master/src/Poptin.php#L69-L74" rel="nofollow noreferrer">https://github.com/poptins/craftcms-poptin-app/blob/master/src/Poptin.php#L69-L74</a></p>
  <p>That's basically overwriting Craft's default Project Config settings for a plugin (which is to be enabled).</p>
  <p><a href="https://github.com/craftcms/cms/blob/develop/src/services/Plugins.php#L536-L545" rel="nofollow noreferrer">https://github.com/craftcms/cms/blob/develop/src/services/Plugins.php#L536-L545</a></p>
  <p>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 <code>init()</code> and into something like an <code>EVENT_AFTER_INSTALL_PLUGIN</code> event.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-22T23:10:43.867Z
Answers.LastActivityDate: 2020-06-22T23:10:43.867Z
Answers.UserDisplayName: Brad Bell
Body: <p>I am developing a plugin for craft 3 and the plugin just got published to the store.</p>
  <p>I can browse through the store and install the plugin but it stays disabled. The user will have to goto Settings -&gt; Plugins and then manually enable the plugin even after installing. Is there a way to auto enable the plugin after install?</p>
  <p><a href="https://i.sstatic.net/z3bxO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/z3bxO.png" alt="Example" /></a></p>
  
Tags: <plugin-development><craft3><php>
Title: How to auto enable a plugin after install?
ThreadText: # How to auto enable a plugin after install?
  
  (Asked by: username_0 on 2020-06-22)
  
  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](https://i.sstatic.net/z3bxO.png)](https://i.sstatic.net/z3bxO.png)
  
  **Tags:** plugin-development, craft3, php
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-22. Score: 1
  
  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.
  
  
  ---
  
  