Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Chatwee Posted May 10, 2017 Posted May 10, 2017 Hello, I've recently created a plugin and it works as expected - as long as I test it in my local enviroment (dev mode enabled). After installing it on the actual community site, it seems that I have to disable the plugin and then enable it again for any changes in the 'edit' section to take effect. Do you guys have any suggestions on what might be causing this issue and how I can fix it? Thanks
CP_User Posted May 10, 2017 Posted May 10, 2017 Use the support tool to clear the cache for the site. It could be a cache issue, worth trying.
Adriano Faria Posted May 10, 2017 Posted May 10, 2017 What you mean by 'edit'? Settings? If so, have you set default values for them?
Daniel F Posted May 10, 2017 Posted May 10, 2017 How are you handing the settings? Are you only updating the database table? This won't be enough, you'll also need to trigger the cache rebuild \IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $v ), array( 'conf_key=?', $k ) ); unset( \IPS\Data\Store::i()->settings );
Chatwee Posted May 10, 2017 Author Posted May 10, 2017 Thank you for your answers. @CP_User Yes, clearing the cache works, but I have to do it everytime I change the settings. Disabling/enabling the plugin takes less time, though @Adriano Faria Yes, this is exactly what I mean and yes, all of them have deafult values. @Daniel F This is the way I am handling the settings: $form->add( new \IPS\Helpers\Form\Checkbox( 'setting1', \IPS\Settings::i()->setting1, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'setting1' ) ) ); $form->add( new \IPS\Helpers\Form\Textarea( 'setting2', \IPS\Settings::i()->setting2, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'setting2' ) ) ); $form->add( new \IPS\Helpers\Form\Checkbox( 'setting3', \IPS\Settings::i()->setting3, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'setting3' ) ) ); if ( $values = $form->values() ) { $form->saveAsSettings(); return TRUE; } return $form; Any suggestions?
HeadStand Posted May 10, 2017 Posted May 10, 2017 Try changing the code to the following: $form->saveAsSettings( $values ); Also, the options you're passing in are incorrect for those form field types. app, key, and autoSaveKey are for Editor type or Translatable only.
Chatwee Posted May 11, 2017 Author Posted May 11, 2017 @HeadStand Thank you for the suggestions. It turns out that this issue was being caused by me using the \IPS\Theme\class_core_front_global hook incorrectly. Thank you all very much
Recommended Posts
Archived
This topic is now archived and is closed to further replies.