Forum

Thread tagged as: Problem, Configuration, Members

Members app Certain tagged members go to certain pages

Perch 2.8.10 v1.3 members My members app is up an working, but needs to be tweeked to direct former members to a renewal screen and members to the site naviagation

Here is what I tried but it doesn't work

<?php 
            if (perch_member_logged_in()) {
                echo '<h3>Willkommen!</h3>';
echo '<p>You are logged-in.</p>';
echo '<ul>
                <li><a href="memberswebsite/">Members Website</a></li>
                    <li><a href="profile.php">Edit profile</a></li>
                    <li><a href="logout.php">Log out/PALAM Public Site</a></li>
                </ul>';
            }else{

                echo '<h3>Willkommen!</h3>';
                echo '<p>You are not logged in. Please login or <a href="/members/register.php">register</a> or <a href="https://www.palamgermangenealogysociety.org/bkstore/index.php?main_page=index&cPath=16">RENEW NOW</a>.</p>';
                echo 'Logged out, return to <a href="https://palam.org">Palatines to America Public Site</a>';
            perch_members_login_form(); 
} 
?>

for notrenewed tag members that try to login, I want something like this but it doesn't work. I am not sure where to put it in the code.


<?php if (perch_member_has_tag('notrenewed')) { echo '<p>Our records indicate you have not renewed. You must renew to gain access to the records. <a href="link to renewal">RENEW NOW</a> For problems contact, <a href="emailaddress?Subject=Login-Palam">webcoordinator</a></p>'; } ?>

I have tried this in the else statement where login would be false but it throws errors in the coding. If put at the end of the else statement it doesn't do anything.

I really would like the works to come up this way

  1. login form
  2. member logins goes to navigation all pages on site are member login protected, but a member that was expired was able to get in, but just not to download the items. there are other pages with material that needs to be protected also but is not in download format. Using this code for that
<?php if (perch_member_logged_in()){ 
...
}
?>

Apparentlly I need mutiple criteria to keep people out that are not current members. Is there a way to automatically change active to inactive on the expire date on the tag?

  1. If members try to login but have messed up their password, they would taken back to the login form.
  2. For expired members / nonrenewals they would get a message that says renew now and a link to the renewal screen.
<?php
if (perch_member_has_tag('notrenewed')) {

echo '<p>Our records indicate you have not renewed. You must renew to gain access to the records. <a href="link to renewal">RENEW NOW</a> For problems contact, <a href="emailaddress?Subject=Login-Palam">webcoordinator</a></p>';

}
        ?>

That is what I tried to do with that code, but is not compatible with the other if put in the else statement when login is false or anywhere else I could think of in the coding.

I did not see an answer to the posts about multiple criteria so I did not try that and am not really sure how of where that would go.

Carol Swinehart

Carol Swinehart 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think you want something like

if (perch_member_logged_in() && !perch_member_has_tag('notrenewed'))
    // they're logged in, and they don't have the 'notrenewed' tag
}

Ok so then how do I get special statements to show up if they have the notrenewed tag ~~ <?php if (perch_member_logged_in() && !perch_member_has_tag('notrenewed')){ echo '<h3>Willkommen!</h3>'; echo '<p>You are logged-in.</p>'; echo '<ul> <li><a href="memberswebsite/">Members Website</a></li> <li><a href="profile.php">Edit profile</a></li> <li><a href="logout.php">Log out/PALAM Public Site</a></li> </ul>'; }else{

            echo '<h3>Willkommen!</h3>';
            echo '<p>You are not logged in. Please login or <a href="/members/register.php">register</a> or <a href="https://www.palamgermangenealogysociety.org/bkstore/index.php?main_page=index&cPath=16">RENEW NOW</a>.</p>';
            echo 'Logged out, return to <a href="https://palam.org">Palatines to America Public Site</a>';
        perch_members_login_form(); 

echo '<p>Our records indicate you have not renewed. You must renew to gain access to the records. <a href="https://www.palamgermangenealogysociety.org/bkstore/index.php?main_page=index&cPath=16">RENEW NOW</a> For problems contact, <a href="webcoordinator@palamgermangenealogysociety.org?Subject=Login-Palam">webcoordinator</a></p>';

}

    ?>

~~~ The above else part shows up for all people who have trouble logging in. I want only notrenewed to see the statement about "Our records show you are not renewed". I only want that statement on the page that the notrenewed people get to after they tried to login and are unsuccessful. I do not want the form or additional information. Only a link to tech support and the Renewal Form in the shopping cart.

What will resolve this problem?

Why is the perch_member_has_tag('notrenewed') not working in the elseif statement below

It is just going to the else statement instead.

~~ <?php if (perch_member_logged_in() && !perch_member_has_tag('notrenewed')){ echo '<h3>Willkommen!</h3>'; echo '<p>You are logged-in.</p>'; echo '<ul> <li><a href="memberswebsite/">Members Website</a></li> <li><a href="profile.php">Edit profile</a></li> <li><a href="logout.php">Log out/PALAM Public Site</a></li> </ul>'; }elseif (perch_member_has_tag('notrenewed')){ echo '<p>Our records indicate you have not renewed. You must renew to gain access to the records. <a href="https://www.palamgermangenealogysociety.org/bkstore/index.php?main_page=index&cPath=16">RENEW NOW</a> For problems contact, <a href="mailto:webcoordinator@palamgermangenealogysociety.org?Subject=Login-Palam">webcoordinator</a></p>';

        }else{

            echo '<h3>Willkommen!</h3>';
            echo '<p>You are not logged in. Please login or <a href="/members/register.php">register</a> or <a href="https://www.palamgermangenealogysociety.org/bkstore/index.php?main_page=index&cPath=16">RENEW NOW</a>.</p>';
            echo 'Logged out, return to <a href="https://palam.org">Palatines to America Public Site</a>';
        perch_members_login_form(); 

}

    ?>

~~

I am trying to get perch_member_has_tag working but it always returns false. I couldn't find has_tag in the codebase, I wonder if it has been removed. Could someone check? Drew?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Dave - please raise your own thread with your code and Diagnostics Report. This thread is 6 months old!