aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-19 18:50:20 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-01-19 18:50:20 +0000
commite46153bc30c1386ad330f15704067cce180f9750 (patch)
tree82216c97286455b67962982719ed05d12c84db3c
parenta0aed2200f61f916624307ddf77ce5bb272faadf (diff)
downloadelgg-e46153bc30c1386ad330f15704067cce180f9750.tar.gz
elgg-e46153bc30c1386ad330f15704067cce180f9750.tar.bz2
Refs #697: Now using plugin hook so one can do live validation of values
git-svn-id: https://code.elgg.org/elgg/trunk@2582 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/plugins.php28
1 files changed, 15 insertions, 13 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index 639a62354..0f9fd46dd 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -412,12 +412,14 @@
//$user->$prefix = $value;
//$user->save();
- if (trigger_elgg_event('plugin:usersetting', 'user', array(
+ // Hook to validate setting
+ $value = trigger_plugin_hook('plugin:usersetting', 'user', array(
'plugin' => $plugin_name,
'name' => $name,
'value' => $value
- )))
- return set_private_setting($user->guid, $prefix, $value);
+ ), $value);
+
+ return set_private_setting($user->guid, $prefix, $value);
}
return false;
@@ -467,19 +469,19 @@
if ($name!='title')
{
- if (trigger_elgg_event('plugin:setting', 'plugin', array(
+ // Hook to validate setting
+ $value = trigger_plugin_hook('plugin:setting', 'plugin', array(
'plugin' => $plugin_name,
'name' => $name,
'value' => $value
- )))
- {
- $plugin->title = $plugin_name;
- $plugin->access_id = 2;
- $plugin->save();
- $plugin->$name = $value;
-
- return $plugin->getGUID();
- }
+ ), $value);
+
+ $plugin->title = $plugin_name;
+ $plugin->access_id = 2;
+ $plugin->save();
+ $plugin->$name = $value;
+
+ return $plugin->getGUID();
}
return false;