If you allowed people to determine who could view their user information, what would be the best way in which to store and access that information?
They would be setting their preferences in any of these ways:
- User Based (select specific users - ie. Block: "Munch", "Dummy")
- Checkbox Based (select one or many groups of users - ie. "My Friends", "Anyone in my Network")
- Radio Button Based (select only one group of users - ie. "Everyone")
My current thought is that, because the information is relevant to the user being viewed and not the one clicking around the site, you would have to store these options in a database, and based on the any particular combination of results, run a certain query.
The only issue is there could be a seemingly huge number of different queries:
- 7 checkboxes could have up to 128 different combinations (2^7)
- 128 combinations = 128 different optimized queries
This does not seem to be efficient in either time spent writing the queries or in the amounts of queries for every page view (querying to get another query to run...blech!).
And because I'm sure this has been done before, I feel like I must be overlooking something. Is there a better way to do this using PHP/MySQL?