aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authornickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-13 21:48:30 +0000
committernickw <nickw@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-04-13 21:48:30 +0000
commit605858b194425aaac889e57b76ed0a346a70815a (patch)
treebf36912608de19e3a3fa8e4e70cfd3290610de36 /engine/lib
parent0e147ddd0f21937023f1042a40d9bd6e159aee67 (diff)
downloadelgg-605858b194425aaac889e57b76ed0a346a70815a.tar.gz
elgg-605858b194425aaac889e57b76ed0a346a70815a.tar.bz2
Creating a function to clear user-specific plugin settings.
git-svn-id: http://code.elgg.org/elgg/trunk@5728 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/plugins.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index bc703f6c6..64f1deb12 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -486,6 +486,36 @@ function set_plugin_usersetting($name, $value, $user_guid = 0, $plugin_name = ""
}
/**
+ * Clears a user-specific plugin setting
+ *
+ * @param str $name Name of the plugin setting
+ * @param int $user_guid Defaults to logged in user
+ * @param str $plugin_name Defaults to contextual plugin name
+ * @return bool Success
+ */
+function clear_plugin_usersetting($name, $user_guid=0, $plugin_name='') {
+ $plugin_name = sanitise_string($plugin_name);
+ $name = sanitise_string($name);
+
+ if (!$plugin_name) {
+ $plugin_name = get_plugin_name();
+ }
+
+ $user = get_entity((int) $user_guid);
+ if (!$user) {
+ $user = get_loggedin_user();
+ }
+
+ if (($user) && ($user instanceof ElggUser)) {
+ $prefix = "plugin:settings:$plugin_name:$name";
+
+ return remove_private_setting($user->getGUID(), $prefix);
+ }
+
+ return FALSE;
+}
+
+/**
* Get a user specific setting for a plugin.
*
* @param string $name The name.