예제 #1
0
/**
 * Friends Picker
 *
 * @return false|null|mixed data
 * @access public
 */
function ossn_friend_picker()
{
    header('Content-Type: application/json');
    if (!ossn_isLoggedin()) {
        exit;
    }
    $user = new OssnUser();
    $friends = $user->getFriends(ossn_loggedin_user()->guid);
    if (!$friends) {
        return false;
    }
    foreach ($friends as $users) {
        $p['first_name'] = $users->first_name;
        $p['last_name'] = $users->last_name;
        $p['imageurl'] = ossn_site_url("avatar/{$users->username}/smaller");
        $p['id'] = $users->guid;
        $usera[] = $p;
    }
    echo json_encode($usera);
}
/**
 * Get friends suggestion
 *
 * @param $guid 'guid' of user
 *
 * @return bool
 */
function ossn_friends_suggestion($guid)
{
    $user = new OssnUser();
    $friends = $user->getFriends($guid);
    if (!$friends) {
        return false;
    }
    foreach ($friends as $friend) {
        $friends_friend[] = $user->getFriends($friend->guid);
    }
    return $friends_friend;
}