aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/plugins.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-09 21:44:12 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-09 21:44:12 +0000
commit6f41511034886224e0888d2f886c7d7ccc48636d (patch)
treec7cdb8a103ce8202fa4568da5c91377d2dea418e /engine/lib/plugins.php
parent3da61eb88485680eb9480c24d56b05d08c218f1b (diff)
downloadelgg-6f41511034886224e0888d2f886c7d7ccc48636d.tar.gz
elgg-6f41511034886224e0888d2f886c7d7ccc48636d.tar.bz2
Refs #2874: More removal of deprecated function user in plugins systems.
git-svn-id: http://code.elgg.org/elgg/trunk@8089 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/plugins.php')
-rw-r--r--engine/lib/plugins.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/engine/lib/plugins.php b/engine/lib/plugins.php
index fc3dc8006..b33b8d0ac 100644
--- a/engine/lib/plugins.php
+++ b/engine/lib/plugins.php
@@ -772,13 +772,15 @@ function elgg_get_calling_plugin_entity() {
/**
* Returns an array of all plugin settings for a user.
*
- * @param mixed $user_guid The user GUID or null for the currently logged in user.
- * @param string $plugin_id The plugin ID
+ * @param mixed $user_guid The user GUID or null for the currently logged in user.
+ * @param string $plugin_id The plugin ID
+ * @param bool $return_obj Return settings as an object? This can be used to in reusable
+ * views where the settings are passed as $vars['entity'].
* @return array
*
* @since 1.8
*/
-function elgg_get_all_plugin_user_settings($user_guid = null, $plugin_id = null) {
+function elgg_get_all_plugin_user_settings($user_guid = null, $plugin_id = null, $return_obj = false) {
if ($plugin_id) {
$plugin = elgg_get_plugin_from_id($plugin_id);
} else {
@@ -789,7 +791,19 @@ function elgg_get_all_plugin_user_settings($user_guid = null, $plugin_id = null)
return false;
}
- return $plugin->getAllUserSettings($user_guid);
+ $settings = $plugin->getAllUserSettings($user_guid);
+
+ if ($settings && $return_obj) {
+ $return = new stdClass;
+
+ foreach ($settings as $k => $v) {
+ $return->$k = $v;
+ }
+
+ return $return;
+ } else {
+ return $settings;
+ }
}
/**