Forum
Hide certain navigation items from Perch Members who are logged in
If a member is logged in - is there anyway of hiding certain navigation items from them.
I know that if (perch_member_logged_in()) can be used on certain elements but I'm unsure how to use this type of thing within the navigation template?
Untested, but I would think you should be able to wrap your nav items with
<perch:member logged-in="true">
in your template. e.g.:But won't this hide all of the navigation items from a logged in member?
Say for example on my Nav I have
Home / About / Registration / Contact
When a user has registered and logged in - I only want them to see
Home / About / Contact
As the registration page is no longer required as they've already filled in this form.
Yes, you are right. Of course! Apologies.
The simplest way I can think of. is to tick 'Hide from main navigation' for the page you want hidden from Logged in Members in Page Options. Then, to display your nav:
However, if you've used 'Hide form main navigation' for other purposes, that may cause problems. In that case you could use Navgroups in the same way.
You could use a page attribute along with Simon's first suggestion.
Or, perhaps this: Back to the Nav template. Give the
<li>
item a class of 'hide' if the url is '/registration/index.php' and the member is logged in. Again, untested.then hide
.hide
with css ?Is this
Correct as this is just outputting this in the html?
I know you can use
but this is a .html page as apposed to a .php page
So my items.html has this:
But that is out putting this:
You need to use Perch template tags in your templates, not in your pages.
Hi Rachel,
Yes I am,
I have this code
in perch > templates > navigation > items.html
But it is still outputting like this:
Do you have the Members app installed?
Yes I do have it installed. I'm just wondering if there's a syntax error there that i'm not seeing perhaps?
It looks like navigation templates aren't parsed for member tags on account of the native integration with Members.
You could pass in a flag:
and then compare that with a page attribute