From e46153bc30c1386ad330f15704067cce180f9750 Mon Sep 17 00:00:00 2001 From: marcus Date: Mon, 19 Jan 2009 18:50:20 +0000 Subject: 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 --- engine/lib/plugins.php | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'engine/lib') 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; -- cgit v1.2.3