Forum

Thread tagged as: Question, Members

Members app - restricting access to a folder

Hi, I did have this working a few weeks ago but I then swapped using the events app for the blog app so that might have done something.

Basically I have an offers page: https://www.lovebedfordoffers.co.uk/offers/

When you click to see an offer I need it to check if you're logged in as a Member, and if not, re-direct you to https://www.lovebedfordoffers.co.uk/members

I know access is controlled by a tag, which is already set up as 'offer' when a new member registers, however I can't remember how to get this bit to work.

Please help.

Rich

Rich Hemery

Rich Hemery 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You just need to check the permissions at the top of the page.

if (perch_member_has_tag('subscriber')) {
     ...
}else{
    PerchSystem::redirect('/somewhere/else');
}

Got it to work with:

<?php include('../perch/runtime.php');
if (perch_member_has_tag('offer')) {
}else{
PerchSystem::redirect('/members');
        }
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Better:

<?php include('../perch/runtime.php');

if (!perch_member_has_tag('offer')) {
    PerchSystem::redirect('/members');
}

?>