[SOLVED] Hiding menu for not logged in people
Posted: Mon May 07, 2012 1:07 am
Hi,
I'm trying to hide menu content (and thus the restricted pages) for people that have not logged in.
I'm running CMSMS 1.10.3.
Have found an excellent document by Robert, dating form 2009, that describes this exact feature. I am unsure, however, if thsi pdf is still valid for later versions of CMSMS.
I followed the PDF up to the point where it comes to hiding menu items for people that are not logged in. Everything else works nicely. If you're not logged in, and you click the menu item the was not supposed tobe visible, you get redirected to the login page.
Maybe my problem just lies in the fact that I used a different template, namely BluecCity, and I do not understand where to incorporate the lines of code to check whether someone's logged in or not.
I copied the BlueCity menu template, and named it bluecity-restricted.
Below is the content :
I tried putting the lines that are mentioned in the document on page 25 into this template in several locations, but the result invariably is that I still see the menu item that is not to be shown until after login.
Could anyone please tell me if this template is useable for this technique anyhow, and if yes, where to place the if statement ?
Did search the forum, but was unable to get to a solution.
Thanks,
Hans
I'm trying to hide menu content (and thus the restricted pages) for people that have not logged in.
I'm running CMSMS 1.10.3.
Have found an excellent document by Robert, dating form 2009, that describes this exact feature. I am unsure, however, if thsi pdf is still valid for later versions of CMSMS.
I followed the PDF up to the point where it comes to hiding menu items for people that are not logged in. Everything else works nicely. If you're not logged in, and you click the menu item the was not supposed tobe visible, you get redirected to the login page.
Maybe my problem just lies in the fact that I used a different template, namely BluecCity, and I do not understand where to incorporate the lines of code to check whether someone's logged in or not.
I copied the BlueCity menu template, and named it bluecity-restricted.
Below is the content :
Code: Select all
{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string='<ul class="unli">' times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string='</li></ul>' times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="menuactive menuparent">
<a class="menuactive menuparent" {elseif $node->current == true}
<li class="menuactive">
<a class="menuactive" {elseif $node->haschildren == true}
<li class="menuparent">
<a class="menuparent" {elseif $node->type == 'sectionheader' and $node->haschildren == true}
<li class="sectionheader"><span class="sectionheader">{$node->menutext}</span>{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="menu_separator" />{else}
<li>
<a {/if}
{if $node->type != 'sectionheader' and $node->type != 'separator'}
{if $node->target}target="{$node->target}" {/if}
href="{$node->url}"><span {if $node->hierarchy=="1"}class="first"{/if}>{$node->menutext}</span></a>
{elseif $node->type == 'sectionheader'}
><span class="sectionheader">{$node->menutext}</span></a>
{/if}
{/foreach}
{repeat string='</li></ul>' times=$node->depth-1}
</li>
</ul>
<div class="clearb"></div>
</div>
{/if}
Could anyone please tell me if this template is useable for this technique anyhow, and if yes, where to place the if statement ?
Did search the forum, but was unable to get to a solution.
Thanks,
Hans