Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted May 10, 20177 yr 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
May 10, 20177 yr Use the support tool to clear the cache for the site. It could be a cache issue, worth trying.
May 10, 20177 yr 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 );
May 10, 20177 yr Author 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?
May 10, 20177 yr 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.
May 11, 20177 yr Author @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
Archived
This topic is now archived and is closed to further replies.