Presets,_adding_to_a_plugin - e107inc/e107v1 GitHub Wiki


title: Presets, adding to a plugin permalink: /Presets,_adding_to_a_plugin/

Presets allow the admin to save a template of their form results - so each time they create a new entry their own default settings are used.

To add a preset to your admin config page, enter the following code, replacing the array values with your own.

Before require_once(e_ADMIN."auth.php") add:

After require_once(e_ADMIN."auth.php") add the following line:

Before the tag add the following:

So, in the example above, the preset called "admin_downloads" is saved and extracted.

Please note that your form elements must have default values in the form of either $name or $_POST['name'].

or

<input type='text' name='myname' value='".$_POST['myname']."' />

Category:PluginWriting