diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-20 17:14:46 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-20 17:14:46 +0000 |
commit | 20b30e0bc0731b440feae8287f37365ce6050bf0 (patch) | |
tree | 8e885b99cdcbdeaa9d47beb9374e27e77d5fcf16 /actions/plugins/settings | |
parent | 3bc3e27d1280383c4e92b0cc4d419521c9ce9e96 (diff) | |
download | elgg-20b30e0bc0731b440feae8287f37365ce6050bf0.tar.gz elgg-20b30e0bc0731b440feae8287f37365ce6050bf0.tar.bz2 |
Closes #66: Per site plugin settings configuration panel.
Use the same technique as edit pages on widgets, i.e.
1) Create a new view in your plugins view/default called settings/PLUGINNAME/edit
Where PLUGINNAME is the plugin directory, eg "river" or "profile".
2) Place your edit code in edit.php, fields should save to params[fieldname].
3) The view will be passed $vars['entity'] which holds any configuration values already set in the metadata.
Note. Settings are PER SITE.
git-svn-id: https://code.elgg.org/elgg/trunk@1031 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'actions/plugins/settings')
-rw-r--r-- | actions/plugins/settings/save.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/actions/plugins/settings/save.php b/actions/plugins/settings/save.php new file mode 100644 index 000000000..0a8991641 --- /dev/null +++ b/actions/plugins/settings/save.php @@ -0,0 +1,36 @@ +<?php + /** + * Elgg plugin settings save action. + * + * @package Elgg + * @subpackage Core + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Marcus Povey + * @copyright Curverider Ltd 2008 + * @link http://elgg.org/ + */ + + $params = get_input('params'); + $plugin = get_input('plugin'); + + $result = false; + + foreach ($params as $k => $v) + { + // Save + $result = set_plugin_setting($k, $v, $plugin); + + // Error? + if (!$result) + { + system_message(sprintf(elgg_echo('plugins:settings:save:fail'), $plugin)); + + forward($_SERVER['HTTP_REFERER']); + + exit; + } + } + + system_message(sprintf(elgg_echo('plugins:settings:save:ok'), $plugin)); + forward($_SERVER['HTTP_REFERER']); +?>
\ No newline at end of file |