Sunday, June 2, 2013

Friends System connected to News Feeds

Friends System connected to News Feeds

I'm currently working on releasing my Social Network soon, but I'm needing help on completing the news feeds for users.
So I want my users to see feeds from friends they're friends with. And if you're not friends with that one user, you cannot see their posts on your homepage.
My table looks like:
users: user_id, username, password, first_name, last_name, email, active, email_code, avatar, type, protected
feeds: id, user_id, username, body, date
buddys: id, user_one, user_two (user_one is the friend requester, while user_two is the receiver)
I'm not sure how to actually grab it from the database because the ways I've used, either worked but showed it to the friends of the friends or didn't work at all.
So an example of what I'm talking about:
3 users. Me, person 1, and person 2
Currently I'm friends with Person 1. And not person 2. So person 1 can see all the posts I've posted on his/her homepage (and the other way around as well), while person 2 cannot.
Now person 1 added person 2, so person 1 can see person 2's posts, and person 2 can see person 1's posts. While I see from person 2 while being friends with person 1.
Hope this made sense and anyone could help me. I've been stuck with this with no help from anyone for a long time now.