Forum

Thread tagged as: Problem, Configuration, Addons

Member Tags not hiding content

Hi there,

I am running the latest version of Perch and it seems the member template tags in templates are showing content. You can see i have a member tag wrapping around a download link but when logged out it is showing the tag.

Regards

<perch:help>
    <p>Maximum image on brand content pages size is 838px wide (DO NOT EXCEED THIS)</p>
</perch:help>
<perch:before>
    <ul class="uk-list uk-margin-large-top uk-margin-large-bottom">
</perch:before>
<h1><perch:content id="brandheading" type="text" label="Brand Heading" required="true" title="true" /></h1>
<perch:content id="text" type="textarea" label="Brand Conent" html="true" editor="redactor" bucket="resources" imagewidth="838"/>
<perch:repeater id="files" label="PDF Files">
<perch:member has-tag="staff">
        <li><p><i class="uk-icon-download"></i> <a class=" uk-margin-small uk-button print" href="<perch:content id="file" type="file" label="File" bucket="pdfdocs" />">
      <perch:content id="link-title" type="text" label="Link Title" required="true" title="true" />
  </a></p>  <perch:else:member />
To access the print ready download link please login.
</perch:member></perch:repeater></li>
<perch:after>
    </ul>
</perch:after>
<hr>
Alec Sharples

Alec Sharples 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have the Members app installed?

How are you displaying the template?

Hi Drew,

Members is installed, latest version.

Page as follows:

<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');
perch_layout('global.top');
perch_layout('global.header');
?>

    <div class="uk-grid uk-margin-large-bottom">
        <div class="uk-width-medium-1-1">
            <nav class="uk-navbar">
                <div class="uk-container uk-container-center">
                    <?php perch_pages_navigation(array(
                      'from-path'           => '/',
                     'template'             => 'mainnav.html',));
                    ?>
                </div>
            </nav>
            </div>
        </div>
    <div class="uk-container uk-container-center">
        <div class="uk-grid" data-uk-grid-margin>
            <div class="flb-sidebar uk-width-medium-1-5">
                <?php perch_pages_navigation(array(
                'from-path'            => '/downloads',
                'template'              => 'sidenav1.html',
                ));?>
            </div>
            <div class="flb-main uk-width-medium-3-4">
                <?php perch_content('Brand Page'); ?>
            </div>

        </div>
    </div>
    <?php
    perch_layout('global.footer');
    ?>
    <?php
    perch_layout('global.bottom');
    ?>

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is this the Brand Page region? If so, switch to perch_content_custom().

Hi Drew,

Thank you very much.

That worked, may I know the reason content custom was required?

Regards

Drew McLellan

Drew McLellan 2638 points
Perch Support

perch_content() renders the template at edit time and stores the resulting HTML. Your user is not present or logged in at that point, so the members tags don't work.

You need to render the template live so that the current member can be taken into account.

Perfect, Drew.

Thank you for your explanation :)