diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-09 21:44:12 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-09 21:44:12 +0000 |
commit | 6f41511034886224e0888d2f886c7d7ccc48636d (patch) | |
tree | c7cdb8a103ce8202fa4568da5c91377d2dea418e /engine/lib/plugins.php | |
parent | 3da61eb88485680eb9480c24d56b05d08c218f1b (diff) | |
download | elgg-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.php | 22 |
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; + } } /** |