Forum
Members Conditional in Navigation
Hi,
I am trying to use a Members conditional based on tag as part of my navigation template, and it is displaying both parts of the conditional regardless of login. My code is just lifted from the docs at this stage:
<perch:member has-tag="trade">
<p>TRADE LOGIN</p>
<perch:else:member />
<p>NON TRADE LOGIN</p>
</perch:member>
The navigation is being called on the page like this:
perch_pages_navigation([
'levels'=>2,
'template'=>['dropdown-refill-level1.html', 'dropdown-refill-level2.html']
]);
The template code is in dropdown-refill-level1.html
. I am thinking it might be an issue with using these tags in perch_pages_navigation
?
Diagnostics report:
Perch Runway: 2.8.24, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24), perch_forms (1.8.3), perch_mailchimp (2.0.1), perch_shop_orders (1.0), perch_shop_products (1.0), perch_shop (1.0g11), perch_members (1.4.3)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_members', 'perch_shop', 'perch_mailchimp' );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Volumes/Data/g Websites/New Development/Newgate/Clocks Build 4 - gamma/admin
PERCH_CORE: /Volumes/Data/g Websites/New Development/Newgate/Clocks Build 4 - gamma/admin/core
PERCH_RESFILEPATH: /Volumes/Data/g Websites/New Development/Newgate/Clocks Build 4 - gamma/admin/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
HTTP_HOST: newgateclocks.dev
DOCUMENT_ROOT: /Volumes/Data/g Websites/New Development/Newgate/Clocks Build 4 - gamma
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Thanks for your help
Should be an issue - what result are you getting?
I am seeing both parts of the conditional, regardless of login. The HTML source is outputting the perch tags too:
My complete template is:
Ultimately I am looking at swapping the href of the
Watches
link depending on whether a Trade customer is logged inOk, I'll take a look.
Normally you'd do that by setting the permissions at the page level, but this should work too.
Cheers Drew,
Page level works, but would be more straightforward to edit one navigation template than all my page templates.
Thanks for your help
Hi guys, I'm just doing a simple log-in form and straight form the
login_form.html
template; I'm also getting both conditionals, i.e. this always displays, even when logged-outWas there a fix for this
Im also getting the same issue with login and logout buttons in my navigation
Hi, I can't see in the Perch code where the Navigation template is parsed by the membership plugin. I use the workround below in a layout. It isn't ideal as it hardcodes the position of the login/logout link & page details but it works for me.