Jump to content

disable/enable plugin for settings changes to take effect


Chatwee

Recommended Posts

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

 

 

Link to comment
Share on other sites

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 );

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...