<?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
$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