<p>In this situation you don't want to use a config file and instead you want to use plugin settings. The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them.</p>

<p><a href="http://buildwithcraft.com/docs/plugins/plugin-settings" rel="nofollow">http://buildwithcraft.com/docs/plugins/plugin-settings</a></p>

CC BY-SA 3.0
2015-02-25T03:28:37.113Z
2015-02-25T03:28:37.113Z
Justin Kimbrell
<p>Is it possible to update the config.php file in a plugin outside of manually opening and adjusting the array? I'm hoping there's a way I can have a certain user group be able to change the array values with the plugin's control panel page.</p>

<p>The config file is very simple, it looks like this:</p>

<pre><code>&lt;?php 

return [

    'active_features' =&gt; [
         'change_team' =&gt; false,
         'change_series' =&gt; false,
         'change_user_settings' =&gt; false,
    ],

];
</code></pre>

<p>And I need a way for them to be able to toggle, say, 'change_team' to true or false every so often. I've searched around and haven't found anything at all to try. Does this kind of functionality exist at all?</p>

CC BY-SA 3.0
2015-02-24T22:41:07.770Z
Wouldn't you just want to use the Plugin settings for this? The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them. I could be wrong, but if it were me I would just create a settings page for this.
Justin Kimbrell
CC BY-SA 3.0
2015-02-24T22:47:12.757Z
I'll look into plugin settings, I didn't even know about those. So much to learn with Craft!
taylor
CC BY-SA 3.0
2015-02-24T22:59:30.817Z
@JustinKimbrell Wanna add that as an answer, Justin?
Brad Bell
<plugin-development><control-panel><php><configuration>
Update Plugin's config.php
# Update Plugin's config.php

(Asked by: username_0 on 2015-02-24)

Is it possible to update the config.php file in a plugin outside of manually opening and adjusting the array? I'm hoping there's a way I can have a certain user group be able to change the array values with the plugin's control panel page.
The config file is very simple, it looks like this:
 [
         'change_team' => false,
         'change_series' => false,
         'change_user_settings' => false,
    ],

];

And I need a way for them to be able to toggle, say, 'change_team' to true or false every so often. I've searched around and haven't found anything at all to try. Does this kind of functionality exist at all?

**Tags:** plugin-development, control-panel, php, configuration

> **Comments:**
> **username_1**: Wouldn't you just want to use the Plugin settings for this? The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them. I could be wrong, but if it were me I would just create a settings page for this.  
> **username_0**: I'll look into plugin settings, I didn't even know about those. So much to learn with Craft!  
> **username_2**: @JustinKimbrell Wanna add that as an answer, Justin?  

---

## 1 answers

### Answer by username_1 on 2015-02-25. Score: 2 | Accepted answer

In this situation you don't want to use a config file and instead you want to use plugin settings. The settings have a UI and save to the db, which does exactly what you want. The config files are meant to only be updated manually updating them.

<http://buildwithcraft.com/docs/plugins/plugin-settings>


---

