From 20b30e0bc0731b440feae8287f37365ce6050bf0 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 20 Jun 2008 17:14:46 +0000 Subject: 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 --- engine/lib/plugins.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'engine/lib/plugins.php') diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php index a91006e1b..51488434c 100644 --- a/engine/lib/plugins.php +++ b/engine/lib/plugins.php @@ -163,7 +163,7 @@ if ($plugins) { - foreach ($plugins as $plugins) + foreach ($plugins as $plugin) if (strcmp($plugin->title, $plugin_name)==0) return $plugin; } @@ -182,14 +182,16 @@ { $plugin = find_plugin_settings($plugin_name); - if (!$plugin) + if (!$plugin) $plugin = new ElggPlugin(); if ($name!='title') { + $plugin->title = $plugin_name; $plugin->$name = $value; - $plugin->save(); + + return $plugin->getGUID(); } return false; @@ -390,6 +392,9 @@ { // Now run this stuff, but only once run_function_once("plugin_run_once"); + + // Register some actions + register_action("plugins/settings/save", false, "", true); } // Register a startup event -- cgit v1.2.3