User Tools

Site Tools


hiding_content_from_visitors_or_members

Hiding Content From Visitors or Members

There are two types of code, one hides things from members and only shows it to guests, and the other hides things from guests and only shows it to members.

Wrapping your content with the following code hides things from guests and only shows it to members.

<!--opt name="tplvars.user_logged"-->
CONTENT
<!--/opt name="tplvars.user_logged"-->

Wrapping your content with the following code hides things from members and only shows it to guests.

<!--opt name="!tplvars.user_logged"-->
CONTENT
<!--/opt name="!tplvars.user_logged"-->

The difference between the 2 codes is the exclamation mark !:
!tplvars and just tplvars

An example use would be a menu item that you want to hide from visitors and show only to members:

<!–opt name="tplvars.user_logged"–>
<li><a class="menu1" href="{tplvars.relative_url}home.php" title="Home"><span>Home</span></a></li>
<!–/opt name="tplvars.user_logged"–>

Or an advertisement that you want to hide from members and show only to visitors:

<!–opt name="!tplvars.user_logged"–>
<div>
Advertisement Here
</div>
<!–/opt name="!tplvars.user_logged"–>

There is no code for displaying content to various membership levels. The reason being is that you have the ability to create custom membership levels. However you can limit access to various features for each membership in the Admin » General Settings » Access Levels section

hiding_content_from_visitors_or_members.txt · Last modified: 2014/04/30 21:39 by admin