Page 1 of 1

FEU/Custom Content - Hide/show menu's

Posted: Wed Jul 29, 2009 12:35 am
by jkessel
Need help on menuing

I want to hide all menu items from non-logged in users except those marked with alias "public_"

I want to show menu items with alias "priv_' to ANY logged in users of any group

I want to show menu items with alias "inv_" only to members of FEU group "investors" - therefore "investors" would still access the other menu items as they are logged in users!

I also want to restrict searching based upon the same FEU group content restrictions

I've tried searching the forums but don't see a solutions which matches this issue

Came close but can't get this to work right

Code: Select all

{if $ccuser->loggedin() && $ccuser->memberof('public')}
       {if $ccuser->memberof('investors')}
        	 {menu template='cssmenu.tpl' excludeprefix='priv_'}
       {else}
        	 {menu template='cssmenu.tpl' excludeprefix='inv_'}
       {/if}
  {else}
         {menu template='cssmenu.tpl' excludeprefix='public_'}
{/if}

Re: FEU/Custom Content - Hide/show menu's

Posted: Wed Jul 29, 2009 2:04 am
by jmcgin51
how about this:
{if $ccuser->loggedin()} && !$ccuser->memberof('investors') //if the user is logged in and is NOT a member of the "investors" group
      {menu template='cssmenu.tpl' includeprefix='public_,priv_'} //include only menu items with public_ and priv_ prefixes
{else if $ccuser->loggedin() && $ccuser->memberof('investors')} //if the user is logged in and IS a member of the "investors" group
       {menu template='cssmenu.tpl' includeprefix='public_,priv_,inv_'} //include public_, priv_, AND inv_ menu items
{else} //in any other case
       {menu template='cssmenu.tpl' excludeprefix='priv_,inv_'} //show the menu without the priv_ and inv_ items (this assumes you only have three types of prefixes, so public_ is the only one left to be shown)
{/if}
There are probably ways to streamline this or make it more efficient, but I think this will get you what you want.

As far as restricting searchability, I can't give you a good answer there.  You can turn on/off allowing a page to be searched, but if you turn it on and a user is not authorized to view the page, I think the page content can still show up in search results.  When the user tries to access the page, he won't be able to, but it's still a loophole that can allow an unauthorized user to view some restricted content.  Hopefully this will be addressed in a future update.

Re: FEU/Custom Content - Hide/show menu's

Posted: Wed Jul 29, 2009 10:32 am
by applejack
For the search results if say all private pages have a parent or root alias of say private then you could filter the search results based upon a match with the URL

Re: FEU/Custom Content - Hide/show menu's

Posted: Wed Jul 29, 2009 6:54 pm
by jkessel
Thanks JM

The code had a couple of syntax errors in it and the one I can't resolve it a smarter compilerr error for the last {else}

so I ended up with this

Code: Select all

{if $ccuser->loggedin() && !$ccuser->memberof('investors')}  {*if the user is logged in and is NOT a member of the "investors" group*}
          {menu template='cssmenu.tpl' includeprefix='public_,priv_'} {*include only menu items with public_ and priv_ prefixes*}
{else if $ccuser->loggedin() && $ccuser->memberof('investors')} {*if the user is logged in and IS a member of the "investors" group*}
        {menu template='cssmenu.tpl' includeprefix='public_,priv_,inv_'} {*include public_, priv_, AND inv_ menu items*}
{*in any other case*}
        {menu template='cssmenu.tpl' excludeprefix='priv_,inv_'} {*show the menu without the priv_ and inv_ items (this assumes you only have three types of prefixes, so public_ is the only one left to be shown)*}
{/if}
Can I PM you an admin login to get this resolved? I don't mind throwing you some $

Re: FEU/Custom Content - Hide/show menu's

Posted: Wed Jul 29, 2009 8:08 pm
by jmcgin51
sure - go ahead

Re: FEU/Custom Content - Hide/show menu's

Posted: Thu Jul 30, 2009 9:23 pm
by jmcgin51
tried to PM you back, but it says your PM box is full...