I have optional content on the password protected site that will be shown unless the user changes his/her preferences. That setting is stored in the db table along with the user id. Currently I have a query at the top of the page that checks with the table and depending what the setting is shows or hides optional content. Somehow I feel that this is something that creates unneeded calls to the db. I'm thinking to do something like:
if (isset($_SESSION['pref'])) {
do whatever preferences is
} else {
hit db to get user preferences stored in the table
$_SESSION['pref'] = $user_preferences;
}
Sounds like a good idea, just wanted to check what other would suggest.
🆒