From e903a56b44ad45da5bd908ffbf895a390b0bb77e Mon Sep 17 00:00:00 2001 From: brettp Date: Sat, 12 Feb 2011 22:13:22 +0000 Subject: Refs #650. Replaced uses for get_metadata_byname() by elgg_get_metadata() git-svn-id: http://code.elgg.org/elgg/trunk@8180 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/classes/ElggEntity.php | 7 ++++++- engine/lib/users.php | 9 ++++++--- views/default/forms/profile/edit.php | 7 +++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php index 2adb322de..8a7c45648 100644 --- a/engine/classes/ElggEntity.php +++ b/engine/classes/ElggEntity.php @@ -237,7 +237,10 @@ abstract class ElggEntity extends ElggData implements */ public function getMetaData($name) { if ((int) ($this->guid) > 0) { - $md = get_metadata_byname($this->getGUID(), $name); + $md = elgg_get_metadata(array( + 'guid' => $this->getGUID(), + 'metadata_name' => $name + )); } else { if (isset($this->temp_metadata[$name])) { return $this->temp_metadata[$name]; @@ -246,6 +249,8 @@ abstract class ElggEntity extends ElggData implements if ($md && !is_array($md)) { return $md->value; + } elseif (count($md) == 1) { + return $md[0]->value; } else if ($md && is_array($md)) { return metadata_array_to_values($md); } diff --git a/engine/lib/users.php b/engine/lib/users.php index fcb489394..2f5d37551 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1062,7 +1062,10 @@ function elgg_set_user_validation_status($user_guid, $status, $method = '') { * @since 1.8.0 */ function elgg_get_user_validation_status($user_guid) { - $md = get_metadata_byname($user_guid, 'validated'); + $md = elgg_get_metadata(array( + 'guid' => $user_guid, + 'metadata_name' => 'validated' + )); if ($md == false) { return; } @@ -1273,7 +1276,7 @@ function user_avatar_hook($hook, $entity_type, $returnvalue, $params) { */ function elgg_user_hover_menu($hook, $type, $return, $params) { $user = $params['entity']; - + if (elgg_is_logged_in()) { if (elgg_get_logged_in_user_guid() != $user->guid) { if ($user->isFriend()) { @@ -1428,7 +1431,7 @@ function elgg_profile_page_handler($page) { /** * Members page handler - * + * * @param array $page url segments */ function elgg_members_page_handler($page) { diff --git a/views/default/forms/profile/edit.php b/views/default/forms/profile/edit.php index 4de6c47fe..4d2987a03 100644 --- a/views/default/forms/profile/edit.php +++ b/views/default/forms/profile/edit.php @@ -9,14 +9,17 @@
- 'name', 'value' => $vars['entity']->name)); ?> + 'name', 'value' => $vars['entity']->name)); ?>
0) { foreach ($profile_fields as $shortname => $valtype) { - $metadata = get_metadata_byname($vars['entity']->guid, $shortname); + $metadata = elgg_get_metadata(array( + 'guid' => $vars['entity']->guid, + 'metadata_name' => $shortname + )); if ($metadata) { if (is_array($metadata)) { $value = ''; -- cgit v1.2.3