ZenphotoCMS Forum
What is best practice to save persistent preferences for plugins? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html)
+--- Thread: What is best practice to save persistent preferences for plugins? (/thread-6591.html)



What is best practice to save persistent preferences for plugins? - hhm - 25-03-2010

Before I start to dissect the code of available plugins:
I'm toying around with writing a plugin in which the admin can set preferences for the plugin which he would want to be persistently stored. Is there an established way of storing such things in the database?

Best regards,
Hans




What is best practice to save persistent preferences for plugins? - wongm - 25-03-2010

Have a look at any of the existing plugins - they use a 'hook' for saving and reading settings. May I suggest my 'image markup generator' plugin? ;-)
http://code.google.com/p/wongm-zenphoto-plugins/




What is best practice to save persistent preferences for plugins? - acrylian - 25-03-2010

It is a good idea to look at existing plugins as most all of theme contain preferences (we call options) right at the beginning. There is also a user guide article about plugins.




What is best practice to save persistent preferences for plugins? - sbillard - 25-03-2010

The best practice with regard to options is to include the plugin filename as part of the option name. This prevents duplication of options names (which would cause problems because only one of the same named options would be stored.)




What is best practice to save persistent preferences for plugins? - hhm - 26-03-2010

Thanks so far. I'll have a look at it and complain later if I can't get it working.