Show certain content blocks only to logged in users

Permalink
Is there a straightforward way to show certain content blocks in a page (marked by a CSS class, or template) only to logged in users?

The filtering must take place on server side, though. A pure CSS solution where you set a "loggedin" class to the body, and then build a "body.loggedin .contentblock { display: block }" rule isn't sufficient, as I want to maintain editing notes in those blocks that shouldn't be in the public pages' source code at all.

pekka
View Replies: View Best Answer
enlil replied on at Permalink Reply
enlil
http://www.concrete5.org/marketplace/addons/guest-views/
Mainio replied on at Permalink Best Answer Reply
Mainio
Should be possible through advanced permissions.

If you want to add a whole area that is only visible to logged in users, that should also be possible through advanced permissions.

If advanced permissions seem like an overkill for the problem, it's also possible with a tiny bit of code:
<?php global $u; if ($u->isLoggedIn()) {
  $a = new Area("Logged In");
  $a->display($c);
} ?>
pekka replied on at Permalink Reply
pekka
Ahh, I was being thick! I was trying to find a way to protect individual *blocks* while of course you can just create a separate area (which makes the most sense anyway). Thanks!