Boost theme - how to hide sidebar by default?

Re: Boost theme - how to hide sidebar by default?

by Vladimir Gomez -
Number of replies: 0

Hello Chye Siaw, everyone.

This worked for me with the side effect that it always closes the sidebar when changing pages (I wanted it to stay open if the user opened it to go to another section). To solve it, I added a variable to the session and tested for it on the if. This is the code:

if (isloggedin() && isset($_SESSION['alreadyloggedin'])) {
    $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
} else {
    $navdraweropen = false;
    $_SESSION['alreadyloggedin'] = true;
}
Hope it helps somebodoy.

Regards,

Vlad.

Edit:
A slightly more efficient version of this code would be:


if (isset($_SESSION['alreadyloggedin'])) {
    if (isloggedin()) {
        $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
    } else {
        $navdraweropen = false;
    }
} else {
    $navdraweropen = false;
    $_SESSION['alreadyloggedin'] = true;
}