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.
[SOLVED] Hiding Restricted Navigation from Users Not Logged In
[SOLVED] Hiding Restricted Navigation from Users Not Logged In
Last edited by ilene on Tue Oct 27, 2009 5:23 pm, edited 1 time in total.
Re: Hiding Restricted Navigation from Users Not Logged In
I'm replying to my initial post by indicating code as code, to make it easier to understand what I'm asking:
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:
================================================================================
================================================================================
The menu template for left-navigation restricted is:
================================================================================
Can anyone see what I'm not doing correctly here?
Sorry for the long code post.
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:
================================================================================
Code: Select all
{process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<link rel="shortcut icon" href="uploads/images/favicon.ico">
<title>{sitename} - {title}</title>
{metadata}
{stylesheet}
{literal}<__script__ type="text/javascript" src="uploads/dynamic-font-resize.js"></__script>{/literal}
<!--[if IE]>
{literal}<__script__ type="text/javascript" src="modules/MenuManager/CSSMenu.js"></__script>{/literal}
<![endif]-->
{* The above JavaScript is required for CSSMenu to work in IE *}
</head>
</__body>
{*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}
<div id="container">
<!-- start header -->
{global_content name='header'}
<!-- end header -->
<!-- start content -->
<div id="contentyellow"><div id="contentint">
<h4>{content block="title"}</h4>
<div id="your-body">{content}</div>
</div>
</div>
<div id="leftpanel">
{content block="leftpanel"}
<div id="sidenav">
{menu template='leftnavigation-restricted' start_level='2' collapse='1' excludeprefix="2009-campaign-for-kids-supporters"}
</div></div>
<div id="sidebar">
<div id="your-body">{content block="sidebar"}</div>
</div>
<!-- end content -->
<!-- start footer/bottom -->
<div id="bottom">{global_content name='bottom'}
</div>
<!-- end footer/bottom -->
{global_content name='ddnav'}</div>
{global_content name='google_analytics'}
<__body>
</__html>
The menu template for left-navigation restricted is:
Code: Select all
{* 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}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" 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->extra1=='restricted' and $ccuser->loggedin()) or $node->extra1== '' }
{if $node->current == true}
<li class="currentpage"><dfn>Current page is {$node->hierarchy}: </dfn>{$node->menutext}
{elseif $node->parent == true}
<li class="activeparent"><a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}
{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />
{else}
<li><a href="{$node->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}</a>
{/if}
{/if}{* node->extra1 *}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
{/strip}
Can anyone see what I'm not doing correctly here?
Sorry for the long code post.
Re: Hiding Restricted Navigation from Users Not Logged In
I have copied your menu template - it does work also excludes prefixes. Just because this menu exists by its own, call menu tag only if visitor is logged in.
Re: Hiding Restricted Navigation from Users Not Logged In
Thank you for confirming that the menu template works. How would I modify the code of the page template to call the menu tag only if the visitor is logged in?
Re: Hiding Restricted Navigation from Users Not Logged In
Code: Select all
{if $ccuser->loggedin()}
{menu template=' this is menu (or anything else) you want only logged in users to see }
{/if}
Re: [SOLVED] Hiding Restricted Navigation from Users Not Logged In
Peciura - Thank you for clarifying. It's working now.
Re: [SOLVED] Hiding Restricted Navigation from Users Not Logged In
Hi , I'm new in CMSMS and struggling to setup a new multilingual site with restricted access to some users.
I've gone trough the documentation of calguy1000 (good stuff !) and numerous postings on this forum.
It helpped me a lot - thanks for all the good idea's - but know I'm stuck with this issue : restricted navigation for not-loggedin users.
Currently working with latest version of CMSMS (v 1.8.1) , FEU and CustomContent (1.5.3).
This is my menu template code, with the login check. Unfortunately the restricted menu items are also visible to non-loggedin users.
I use the 'Extra1' page attribute to indicate that pages are restricted (value = RES).
Can anyone clarify and help please ? Many thanks in advance.
I've gone trough the documentation of calguy1000 (good stuff !) and numerous postings on this forum.
It helpped me a lot - thanks for all the good idea's - but know I'm stuck with this issue : restricted navigation for not-loggedin users.
Currently working with latest version of CMSMS (v 1.8.1) , FEU and CustomContent (1.5.3).
This is my menu template code, with the login check. Unfortunately the restricted menu items are also visible to non-loggedin users.
I use the 'Extra1' page attribute to indicate that pages are restricted (value = RES).
Code: Select all
{* 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 *}
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" 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}
{*additional line to hide restricted pages from menu*}
{if ($node->extra1 == 'RES' and $ccuser->memberof('members')) or $node->extra1 ==''}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="menuactive menuparent"><a class="menuactive menuparent" href="{$node->url}"><span>{$node->menutext}</span></a>
{elseif $node->haschildren == true and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="parent"><a class="parent" href="{$node->url}"><span>{$node->menutext}</span></a>
{elseif $node->current == true}
<li class="currentpage"><h3><span>{$node->menutext}</span></h3>
{elseif $node->type == 'sectionheader'}
<li class="sectionheader"><span>{$node->menutext}</span>
{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />
{else}
<li><a href="{$node->url}"><span>{$node->menutext}</span></a>
{/if}
{*closing if for hiding restricted pages from menu*}
{/if} {* node->extra1 *}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
Re: [SOLVED] Hiding Restricted Navigation from Users Not Logged In
Since CMSms-mle-fork is not officially supported (read here http://forum.cmsmadesimple.org/index.ph ... #msg181580) and
has it's own forum you should post there http://forum.cmsmadesimple.org/index.ph ... ,41.0.html .
Open your new topic in mle forum and delete this one.
Sorry about that.
has it's own forum you should post there http://forum.cmsmadesimple.org/index.ph ... ,41.0.html .
Open your new topic in mle forum and delete this one.
Sorry about that.
Re: [SOLVED] Hiding Restricted Navigation from Users Not Logged In
Thanks for the fast reply Peciura, but my question was not related to the multilingual aspect of the coding, but about the menu template for hiding resticted pages in the menu to non-logedin visitors.
I am aware of the non-official MLE-fork version and the non-official support.
I've made a new post meanwhile, better explaining my needs.
I am aware of the non-official MLE-fork version and the non-official support.
I've made a new post meanwhile, better explaining my needs.