[eluser]rich.a.coy[/eluser]
Ok, found a small flaw in the SQL. It's returning the logged in users posts also. They should not be returned.
friendships.member1 is the logged in users id and friendships.member2 is the user_id of other person in the friendship.
$me is set to be the user id of the person logged in.
Here is the current statement:
Code:
SELECT f.member1, f.member2, f.level, up.user_id, up.photo_url, up.show_photo, p.*
FROM ((friendships AS f) LEFT JOIN (user_profiles AS up) on f.member2 = up.user_id)
LEFT JOIN (posts AS p) ON f.member2 = p.user_id
WHERE f.member1 = '".$me."'
AND f.level = 'f'
OR (f.level = 'a' AND p.viewable = 'a')
ORDER BY p.date DESC
Any clue how the logged in users posts are getting added?
Thanks.
Rich