]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
sorting friends list and going beyond 10
authorCash Costello <cash.costello@gmail.com>
Thu, 2 Jul 2009 11:37:05 +0000 (11:37 +0000)
committerCash Costello <cash.costello@gmail.com>
Thu, 2 Jul 2009 11:37:05 +0000 (11:37 +0000)
views/default/tidypics/tagging.php

index eb5f7e208469d6fab4b09c8c77a129292857e11a..513845e3297063dc3655fa2151c051f4e62f946a 100644 (file)
 <?php\r
 \r
        if($viewer) {\r
-               $friends = get_entities_from_relationship('friend', $viewer->getGUID(), false, 'user', '', 0);\r
+               $friends = get_entities_from_relationship('friend', $viewer->getGUID(), false, 'user', '', 0, 'time_created desc', 1000);\r
+               \r
+               if ($friends) {\r
+                       foreach($friends as $friend) {\r
+                               $friend_array[$friend->name] = $friend->getGUID();\r
+                       }\r
+               }\r
+               ksort($friend_array);\r
 \r
                $content = "<input type='hidden' name='image_guid' value='{$file_guid}' />";\r
                $content .= "<input type='hidden' name='coordinates' id='coordinates' value='' />";\r
@@ -41,8 +48,8 @@
                $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$viewer->getGUID()},\"{$viewer->name}\")'> {$viewer->name} (" . elgg_echo('me') . ")</a></li>";\r
        \r
                if ($friends) {\r
-                       foreach($friends as $friend) {\r
-                               $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$friend->getGUID()}, \"{$friend->name}\")'>{$friend->name}</a></li>";\r
+                       foreach($friend_array as $friend_name => $friend_guid) {\r
+                               $content .= "<li><a href='javascript:void(0)' onclick='selectUser({$friend_guid}, \"{$friend_name}\")'>{$friend_name}</a></li>";\r
                        }\r
                }\r
        }\r