1

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:

<?php 

return [

    'active_features' => [
         '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?

3
  • 2
    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. Commented Feb 24, 2015 at 22:41
  • I'll look into plugin settings, I didn't even know about those. So much to learn with Craft!
    – taylor
    Commented Feb 24, 2015 at 22:47
  • @JustinKimbrell Wanna add that as an answer, Justin?
    – Brad Bell
    Commented Feb 24, 2015 at 22:59

1 Answer 1

2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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