From 2ae1490a0bd5b2350b8b0d61191c2febc96cb4b5 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Tue, 1 Sep 2009 12:29:59 +0000 Subject: fixed tag list combining and sorting --- lib/image.php | 16 ++++++++++++---- 1 file 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; } -- cgit v1.2.3