Ne elde etmek çalışıyorum karmaşık bir gizlilik rutin olduğunu, i aşağıdaki tablolar vardır.
ileti
ileti_privacy
privacy_global
followerlist
We have a news feed sort of thing on our site, which gets the 10 latests ileti from the people a user is following, there are 3 levels of privacy, first is privacy_global where the user can set a privacy options on his ileti , 0 , 1 and 2 for "Only me", "Everyone", "followers only" respectively, then there is ileti_privacy where the user can choose to list people he wants to show to or hide the post from before posting it, this setting overrides the privacy_global settings and ileti_privacy instead if set.
now what my problem is that, when i apply privacy in the news feed using php I basically ask for the ileti like this.
SELECT `post`.*,
`users`.`fullname`,
`users`.`username`,
`ileti_privacy`.`hide`,
`ileti_privacy`.`show`,
FROM `post`
LEFT JOIN `ileti_privacy` ON `post`.`id`=`ileti_privacy`.`postid`
INNER JOIN `users` ON `post`.`userid` = `users`.`id`
WHERE (`post`.`userid` IN (1,2,3,4,5,6)
AND 12 NOT IN (
SELECT `hide` FROM `ileti_privacy` WHERE `postid`=`post`.`id`)
OR `show`= 12
)
GROUP BY `post`.`id`
ORDER BY `time` DESC LIMIT 10"
I cant figure out how to apply all the other conditions, before this i was using another query and returning serialized arrays of people that the post needs to be hidden or shown to, then unserialized and proccessed it in php and removed that post from the array before being sent to the browser, that created a hole in the news feed, instead of loading 10 ileti only 6 ileti appear becasue php removed the 4 that had privacy before they made it to the browser, my goal here is to do EVERYTHING all the privacy conditions in SQL before the ileti leave the database, so I dont have this issue with the counts of the ileti in the newsfeed.
Ben MySQL fonksiyonları ve prosedürleri içine bakarak çalıştım ama onlar işlem sorguları veya iade tabloları edemeyiz söylendi.
Bu sorunu yaklaşım nasıl olarak herhangi bir tavsiye?
EDIT: Bu yardımcı olur, ben yapmaya çalışıyorum sistem kullanıcı sonrası specfic gizlilik ayarlayabilirsiniz Facebook'ta, o simlar, aynı zamanda bu bitince overridded olsun küresel ayarları vardır.
Tablo yapıları:
followerslist:
id PRIMARY KEY BIGINT(20)
userid BIGINT(20) << id of the user who clicks the follow button
targetid BIGINT(20) << id of the user who gets followed
Mesajı:
id PRIMARY KEY BIGINT(20)
content TEXT
title VARCHAR(100)
time DATETIME
userid BIGINT(20)
ileti_privacy:
id PRIMARY KEY BIGINT(20)
postid BIGINT(20)
hide BIGINT(20)
show BIGINT(20)