Fork me on GitHub
Current Releases are 2.1 stable (major release) and (security patch for 2.0)
We've also rebooted our GitHub repo, docs, and more!

[Documentation] How can I hide the right column ( Panel ) from Guests ?

edited April 2012 in Questions

Hi guys,

I'm still very new to Vanilla Forums. and need some help.

I would like to make my forum to be a closed community which only registered users can see everything.

I unchecked everything at the Guest Role Setting page ( ) so guests can only see the header/footer, title logos, basic menu and log in/register forms. Until this part, I have no problem. Vanilla is perfect.

But here's the thing I have to solve.

Guests can still see the whole right column ( id="Panel" ). But I would like to show GuestBox ( id="GuestBox") only for guests in the right column. And hide the rest of right column from guests.

Is anyone can tell me how to do it ? I'm only a frontend designer and very little experience with PHP or any programming.

So any help will be greatly appreciated.

Thank you


Best Answer


  • edited April 2012

    Hi UnderDog,

    Thank you very much for your reply.
    But I'm still wondering what to be written in "Show the Panel Asset" part of default.master.php.

    $Session = Gdn::Session();

    if ($Session->IsValid())


    Show the Panel Asset

    } else


    Show only the Guest Box asset



    My code is like this now.


    <?php <br />

    $Session = Gdn::Session();

    if ($this->Menu) {

    $this->Menu->AddLink('Linktitle', T('About'), '/categories/office');

    //$this->Menu->AddLink('Linktitle', T('Topics'), '/categories/all');

    $this->Menu->AddLink('Dashboard', T('Admin'), '/dashboard/settings',

    if ($Session->IsValid()) {

    $Name = $Session->User->Name;

    $CountNotifications = $Session->User->CountNotifications;

    if (is_numeric($CountNotifications) && $CountNotifications > 0)

    $Name .= ' < span class="Alert" >'. $CountNotifications.'';

    if (urlencode($Session->User->Name) == $Session->User->Name)

    $ProfileSlug = $Session->User->Name;


    $ProfileSlug = $Session->UserID.'/'.urlencode($Session->User->Name);

    $this->Menu->AddLink('User', $Name, '/profile/'.$ProfileSlug, array('Garden.SignIn.Allow'),
    array('class' => 'UserNotifications'));

    $this->Menu->AddLink('SignOut', T('Sign Out'), SignOutUrl(), FALSE, array('class' =>
    'NonTab SignOut'));

    } else {

    $Attribs = array();

    if (SignInPopup() && strpos(Gdn::Request()->Url(), 'entry') === FALSE)

    $Attribs['class'] = 'SignInPopup';

    $this->Menu->AddLink('Entry', T('Sign in'), SignInUrl($this->SelfUrl), FALSE, array('class' => 'NonTab'), $Attribs);


    echo $this->Menu->ToString();



  • UnderDogUnderDog Moderator
    edited April 2012

    Scroll waaayyy down in that same default.master.php file.

    Try to find the word 'Assed' in that same file. It's close to the


    div id="Panel">It's usually something like $this->RenderAsset('Panel')

    Apply the code I showed above:

    if ($Session->IsValid())

  • edited April 2012

    Hi UnderDog,

    Thank you so much for your help.
    I really appreciate it.

    But I still have problems...

    I tried it. but GuestBox is included in Panel.
    And I don't know how to separate them.

    One more thing is that my right column includes other extra things that I added to default.master.php like Facebook Like box or Google Adsense Ads. Those things makes this right column very long... so I need to hide them together with 'Panel' from Guests.

    Is there any way that I put those extra things into "Panel".


    Is there any easy simple code you can write to hide them ?
    I need some simple code which surround something to hide it from guests.

    I tried to use the code you showed me above like...

    if ($Session->IsValid())





    but it ended up with errors...

    Hope you get what I'm trying to explain here.
    I wish I knew some PHP...but I don't.
    Need your help.

    Thank you,

Sign In or Register to comment.