These 4 fields are related to each other.

I want him to output it as: 
In my request :
SELECT users.firstname, users.lastname, users.screenname, posts.post_id, posts.user_id,
posts.post, posts.upload_name, posts.post_type,
DATE_FORMAT(posts.date_posted, '%M %d, %Y %r') AS date,
COUNT(NULLIF(feeds.user_id, ?)) AS everybody, SUM(feeds.user_id = ?) AS you,
GROUP_CONCAT(CASE WHEN NOT likes.user_id = ? THEN
CONCAT_WS(' ', likes.firstname, likes.lastname)
END
) as names
FROM website.users users
INNER JOIN website.posts posts ON (users.user_id = posts.user_id)
LEFT JOIN website.feeds feeds ON (posts.post_id = feeds.post_id)
LEFT JOIN website.users likes ON (feeds.user_id = likes.user_id)
GROUP BY posts.pid
ORDER BY posts.pid DESC
Now I have a problem, with what part should I join the friends table , I want to show all messages from friend_id or user_id , as well as a message from the user who is currently logged in. If no friend matches the friend’s table , then simply print all messages from the user. Please guys, I need your help.
friends.friend_id = friend of the current user
friends.user_id = current user user
So friends.friend_id = posts.user_id or friends.user_id = posts.user_id
, , , .