PDA

View Full Version : Code for hiding certain boxes for logged in users



Peter Jonsson
September 21, 2012, 08:12 PM
Are there anycode we can use for hiding different blocks from lets say logged in/registered users so only guests sees it.

I want a box with register now and get blah blah but it's kinda wierd to see that box if you are logged in.

There should be a button when creating boxes on who we want to see the box.

Morgan Bohman
September 22, 2012, 06:00 AM
Hej,
If you use the small login and register buttons that is original at the right top, then you will not see this. But I guess you use the block, I'm sure that in 3.2 the block showed your account and logout button. Wait in the General_Sky template it will do that! Maybe you could check that?

Mike
September 22, 2012, 10:09 AM
It seems very simple thing, but strange it's first time i see request about it. I think we will add "Hide for logged in users" option to the content boxes in next update.

For now you can use following code to hide it for logged in users:



{if !$isLogin}
your box content here
{/if}


but it will work only with Smarty boxes (type smarty), and it's better to disable Box Style for such box. Because if box style enabled and there is no content not good to see empty box (when you are logged in)