dimanche 27 juin 2021

Return The Records Of Myself And Other Users?

I have this query. It works but it is not returning records for the logged in user, only the users they follow. I want it to do both: return the users own posts plus people they follow on the site

(the code below just duplicates the logged in users own posts)


$FetchFollowing = $db->fetchAll("SELECT  xf_social_feeds.*, xf_user_follow.* 
    FROM xf_user_follow
   JOIN xf_social_feeds
     ON xf_user_follow.follow_user_id = xf_social_feeds.user_id_feeds
    WHERE xf_user_follow.user_id = '$uid'
      OR xf_social_feeds.user_id_feeds = '$uid' 
    ORDER by id DESC LIMIT $DefaultLoadLimit");

I could just put the user in the followers table when they register but i'm hoping to try to find a better solution first even if i have to ask on here




Aucun commentaire:

Enregistrer un commentaire