[SOLVED] Hiding Restricted Navigation from Users Not Logged In
Posted: Tue Oct 27, 2009 5:53 am
I've just upgraded site to CMSMS 1.6.6 and installed FEU and Custom Content modules. Everything seems OK, except having trouble hiding the restricted menu for users not logged in.
SIte: http://www.vnacs.org/index.php?page=login
Problem: Left menu that says Board Member's only shouldn't be showing unless you're logged in.
The page that's restricted is using the following template: VNACS interior - restricted
with the following code:
================================================================================
{process_pagedata}
{sitename} - {title}
{metadata}
{stylesheet}
{literal}{/literal}
{literal}{/literal}
{* The above JavaScript is required for CSSMenu to work in IE *}
{*For Front End User Module Install, October 26, 2009, if user is not logged in, redirect to the page with the alias of 'login"*}
{if !$ccuser->loggedin()}{redirect_page page='login'}{/if}
{global_content name='header'}
{content block="title"}
{content}
{content block="leftpanel"}
{menu template='leftnavigation-restricted' start_level='2' collapse='1' excludeprefix="2009-campaign-for-kids-supporters"}
{content block="sidebar"}
{global_content name='bottom'}
{global_content name='ddnav'}
{global_content name='google_analytics'}
================================================================================
The menu template for leftnavigation-restricted is:
{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *}
{strip}
{if $count > 0}
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}
{elseif $node->index > 0}
{/if}
{if ($node->extra1=='restricted' and $ccuser->loggedin()) or $node->extra1== '' }
{if $node->current == true}
Current page is {$node->hierarchy}: {$node->menutext}
{elseif $node->parent == true}
url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>{$node->menutext}
{elseif $node->type == 'sectionheader'}
{$node->menutext}
{elseif $node->type == 'separator'}
{else}
url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}>{$node->menutext}
{/if}
{/if}{* node->extra1 *}
{/foreach}
{repeat string="" times=$node->depth-1}
{/if}
{/strip}
================================================================================
Can anyone see what I'm not doing correctly here? Tried following tutorial "Hiding Private Content in CMS Made simple" Everything else works fine.
Thanks.
SIte: http://www.vnacs.org/index.php?page=login
Problem: Left menu that says Board Member's only shouldn't be showing unless you're logged in.
The page that's restricted is using the following template: VNACS interior - restricted
with the following code:
================================================================================
{process_pagedata}
{sitename} - {title}
{metadata}
{stylesheet}
{literal}{/literal}
{literal}{/literal}
{* The above JavaScript is required for CSSMenu to work in IE *}
{*For Front End User Module Install, October 26, 2009, if user is not logged in, redirect to the page with the alias of 'login"*}
{if !$ccuser->loggedin()}{redirect_page page='login'}{/if}
{global_content name='header'}
{content block="title"}
{content}
{content block="leftpanel"}
{menu template='leftnavigation-restricted' start_level='2' collapse='1' excludeprefix="2009-campaign-for-kids-supporters"}
{content block="sidebar"}
{global_content name='bottom'}
{global_content name='ddnav'}
{global_content name='google_analytics'}
================================================================================
The menu template for leftnavigation-restricted is:
{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *}
{strip}
{if $count > 0}
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="" times=$node->prevdepth-$node->depth}
{elseif $node->index > 0}
{/if}
{if ($node->extra1=='restricted' and $ccuser->loggedin()) or $node->extra1== '' }
{if $node->current == true}
Current page is {$node->hierarchy}: {$node->menutext}
{elseif $node->parent == true}
url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>{$node->menutext}
{elseif $node->type == 'sectionheader'}
{$node->menutext}
{elseif $node->type == 'separator'}
{else}
url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}>{$node->menutext}
{/if}
{/if}{* node->extra1 *}
{/foreach}
{repeat string="" times=$node->depth-1}
{/if}
{/strip}
================================================================================
Can anyone see what I'm not doing correctly here? Tried following tutorial "Hiding Private Content in CMS Made simple" Everything else works fine.
Thanks.