diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-09-01 12:29:59 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-09-01 12:29:59 +0000 |
commit | 2ae1490a0bd5b2350b8b0d61191c2febc96cb4b5 (patch) | |
tree | b8129c3432f48ca9be86be29b981d3c8b8d9f497 | |
parent | bdc8df4e735666ab286ce3e14f7baf0dada68d11 (diff) | |
download | elgg-2ae1490a0bd5b2350b8b0d61191c2febc96cb4b5.tar.gz elgg-2ae1490a0bd5b2350b8b0d61191c2febc96cb4b5.tar.bz2 |
fixed tag list combining and sorting
-rw-r--r-- | lib/image.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/image.php b/lib/image.php index f146aba1a..f782f0386 100644 --- a/lib/image.php +++ b/lib/image.php @@ -155,6 +155,7 @@ $friend_list = array(); if ($friends) { foreach($friends as $friend) { + //error_log("friend $friend->name"); $friend_list[$friend->guid] = $friend->name; } } @@ -170,17 +171,24 @@ { foreach ($members as $member) { - if ($viewer_guid != $member->guid) + if ($viewer_guid != $member->guid) + { $group_list[$member->guid] = $member->name; + //error_log("group $member->name"); + } } // combine group and friends list - $friend_list = array_merge($friend_list, $group_list); - $friend_list = array_unique($friend_list); + $intersect = array_intersect_key($friend_list, $group_list); + $unique_friends = array_diff_key($friend_list, $group_list); + $unique_members = array_diff_key($group_list, $friend_list); + //$friend_list = array_merge($friend_list, $group_list); + //$friend_list = array_unique($friend_list); + $friend_list = $intersect + $unique_friends + $unique_members; } } - sort($friend_list); + asort($friend_list); return $friend_list; } |