root/releases/0.1.2a/units/friends/get_friends.php

Revision 2, 0.7 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Gets all the friends of a particular user, as specified in $parameter[0],
4     // and return it in a data structure with the idents of all the users
5     
6         $ident = (int) $parameter[0];
7         
8         if (!isset($_SESSION['friends_cache'][$ident]) || (time() - $_SESSION['friends_cache'][$ident]->created > 120)) {
9             $_SESSION['friends_cache'][$ident]->created = time();
10             $_SESSION['friends_cache'][$ident]->data = db_query("select friends.friend as user_id,
11                                         users.name from friends
12                                         left join users on users.ident = friends.friend
13                                         where friends.owner = $ident");
14         }
15         $run_result = $_SESSION['friends_cache'][$ident]->data;
16                 
17 ?>
Note: See TracBrowser for help on using the browser.