Carry out the following steps:
We've already seen how we can hide a page or even a block from a user by using the concrete5 user interface in combination with the advanced permission mode.
Let's hide content by using some code. Put the following lines in
default.php
:<?php $u = new User(); if ($u->isLoggedIn()) { echo '<a href="/secret/">Secret key to world domination</a>'; } $b = new Area('Main'); $b->display($c); ?>
The preceding two Time for action sections can both be used to change the content by adding some logic to the template.
While we've put both of them in a theme template, they are not only restricted to this location. You can use the command new
User()
almost anywhere in concrete5. The method $c->isEditMode()
also works in several places: theme templates, page list templates, or autonav templates.