You need to perform some extra steps if your plugin needs settings to be saved and controlled via the administration panel:
An example `edit.php` would look like:
<p> <?php echo elgg_echo('myplugin:settings:limit'); ?> <select name="params[limit]"> <option value="5" <?php if ($vars['entity']->limit == 5) echo " selected=\"yes\" "; ?>>5</option> <option value="8" <?php if ((!$vars['entity']->limit) || ($vars['entity']->limit == 8)) echo " selected=\"yes\" "; ?>>8</option> <option value="12" <?php if ($vars['entity']->limit == 12) echo " selected=\"yes\" "; ?>>12</option> <option value="15" <?php if ($vars['entity']->limit == 15) echo " selected=\"yes\" "; ?>>15</option> </select> </p>
Your plugin might need to store per user settings too, and you would like to have your plugin's options to appear in the user's settings page. This is also easy to do and follows the same pattern as setting up the global plugin configuration explained earlier. The only difference is is that instead of using a `settings` folder you will use `usersettings`. So, the path to the user edit view for your plugin would be `usersettings/your_plugin/edit.php`.
To retrieve settings from your code use:
get_plugin_setting($name, $plugin_name = "");
or
get_plugin_usersetting($name, $user_guid = 0, $plugin_name = "");
where:
Values may also be set from within your plugin code, to do this use one of the following functions:
set_plugin_setting($name, $value, $plugin_name = "");
or
set_plugin_usersetting($name, $value, $user_guid = 0, $plugin_name = "");