Forum

Thread tagged as: Problem, Members

Tagged and Untagged User Content is Appearing

Hi,

I'm attempting to utilize tags in an inverted way, by which content unlocks after an expiration date. However, I'm running into a snag. In my HTML template for testing against a tag, it doesn't appear to be working. The content for both tagged and non-tagged users is appearing in the browser. Any help?

<perch:member has-tag="guitar-lesson-2">

        <h1>Hey There -This content is locked</h1>

 <perch:else:member />
        <a href="<perch:content type="text" id="lesson-url-2" label="Link to Lesson Page" divider-before="Lesson 2"/>">
                <li>
                    <div class="vma-circle"><h1></h1></div>
                    <h2><perch:content type="text" id="lesson-title-2" label="Lesson Title"  title="true"/></h2>
                    <p><perch:content type="textarea" id="lesson-description-2" label="Lesson Description" size="s" help="Provide a 1 sentece description of this video lesson."/></p>
                </li>
        </a>
</perch:member>

Greg Stone

Greg Stone 0 points

  • 5 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Greg

can we see your Diagnostics report, short version? We need this with each new thread to the forum.

Oh yeah, sorry about not including that.

Perch: 2.8.29, PHP: 5.6.22, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_shop_orders (1.0.2), perch_shop_products (1.0.2), perch_shop (1.0.2), perch_members (1.4.2)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/gregston/public_html/vma/perch
PERCH_CORE: /home/gregston/public_html/vma/perch/core
PERCH_RESFILEPATH: /home/gregston/public_html/vma/perch/resources
Image manipulation: GD
PHP limits: Max upload 64M, Max POST 64M, Memory: 128M, Total max file upload: 64M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
DOCUMENT_ROOT: /home/gregston/public_html/vma
HTTP_HOST: vma.champkiddesign.com
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which page function are you using to display this template?

Hi,

I'm using this method from an PHP include on the dashboard.php. I've also tried it without using an include.

perch_content('Title Here');
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you view source, do you see any Perch tags?

Hmmmm.... That's a good question. I've since tried various methods of making this work so my original problem here isn't viewable by the source code anymore. But I know that the adding/removing tags function was working as expected.

I've tried abandoning the HTML and just doing it in PHP like this, but it's still showing content for both tagged and untagged :

if (perch_member_has_tag('guitar-lesson-2')) { // <---- This tag expires 1 week from sign up

        echo null; // <---- I want to show nothing when tagged

    } else { //<---- When tag expires, I want a new lesson to appear. 

     perch_content_create('Lesson 2', array(
                'template' => 'lesson-list.html',
                'multiple' => false,
                'shared' => false,
                    )); 
      perch_content('Lesson 2');

      } 

I hope that makes sense.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It doesn't much - I can't see how your if statement can be both true and false at the same time.

Essentially, I'm trying to use the Members Tag backwards. I have a client that wants to drip content weekly relative to the member's sign up date. So I thought I would use the tags with relative expiration dates to essentially hide content until it expires.

If they have a specific tag = echoes no content When the tag expires = echoes content

Perhaps there's an easier way to do this? I just thought this would work.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You might need to check that they're also logged in - otherwise they'll have no tag.

So I'm still not understanding why tags isn't working just "normally"... It works just fine on my dashboard.php, but when I go to call a tag in a html template, it doesn't work. which seems to be my biggest battle.

Using the example on the Perch website, am I able to use <perch:member> and <perch:content> together? If so, for whatever reason this isn't working for me.

<perch:member has-tag="guitar-lesson-3">
            <p>
            <perch:content type="text" id="text" label="Title"/>
            </p>
        <perch:else:member />
            <p>Please email for more information.</p>
        </perch:member>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you still using perch_content() or have you switched to perch_content_custom() ?

Okay, so I'm in an entirely new project and I'm still having problems understanding why my perch HTML template will not compute something like this.

<perch:member has-tag="boardmember">
    <p>Contact Bill for more information (direct line: 01234 5667890)</p>
<perch:else:member />
    <p>Please email for more information.</p>
</perch:member>

Both the tagged and untagged information is appearing. I've done this a million times in other projects with the PHP option -what am I missing for the HTML not to work?

I've created a region from PHP in the following code, and I'm including the <perch:member> tags within the news.html

<?php 
      perch_content_create('News Item', array(
                'template' => 'news.html',
                'multiple' => false,
                'shared' => false,
                    )); 
      perch_content('News Item');
 ?> 

Any help would be appreciated. Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

Does it make a difference if you use perch_content_custom()?

That did it! Not sure how I missed this. Thank you so much.