aboutsummaryrefslogtreecommitdiff
path: root/engine
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
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')
-rw-r--r--engine/lib/admin.php4
-rw-r--r--engine/lib/deprecated-1.8.php14
-rw-r--r--engine/lib/plugins.php22
3 files changed, 21 insertions, 19 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index d076bbd3d..0ec02cded 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -202,8 +202,8 @@ function admin_settings_page_handler($page) {
&& elgg_view_exists("settings/{$page[1]}/edit")) {
$view = '/admin/components/plugin_settings';
- $vars['plugin'] = $page[1];
- $vars['entity'] = find_plugin_settings($page[1]);
+ $plugin = elgg_get_plugin_from_id($page[1]);
+ $vars['plugin'] = $plugin;
$title = elgg_echo("admin:plugin_settings:{$page[1]}");
$title = elgg_echo("admin:{$page[0]}");
} else {
diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php
index 684e8f9b3..ee3265a12 100644
--- a/engine/lib/deprecated-1.8.php
+++ b/engine/lib/deprecated-1.8.php
@@ -2972,19 +2972,7 @@ function load_plugins() {
*/
function find_plugin_usersettings($plugin_id = null, $user_guid = 0) {
elgg_deprecated_notice('find_plugin_usersettings() is deprecated by elgg_get_all_plugin_user_settings()', 1.8);
-
- $settings = elgg_get_all_plugin_user_settings($user_guid, $plugin_id);
- $return = false;
-
- if ($settings) {
- $return = new stdClass;
-
- foreach ($settings as $k => $v) {
- $return->$k = $v;
- }
- }
-
- return $return;
+ return elgg_get_all_plugin_user_settings($user_guid, $plugin_id, true);
}
/**
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;
+ }
}
/**