Forum

Thread tagged as: Question, Addons, Members

Member access to multiple pages

Hi,

I'm currently building a members area using the members app, but have run into a problem that is bugging me (hopefully I'm overlooking something and its a simple fix).

I have a main Case Studies page (www.mysite.com/casestudies) and a series of links within that go to seperate pages, with the link to each like so: www.mysite.com/casestudies/firstsite.php

In my case studies page I have...

<?php if (perch_member_has_tag('client')) { perch_content('Case Studies'); }else{ perch_members_login_form(); }; ?>

So the member has to log in, and hold a certain tag, before viewing the links to the case studies, which all works fine.

What they can do though is just bypass the log in and go straight to the case study itself using the full link, e.g. www.mysite.com/casestudies/firstsite.php

Is there a way to stop this happening?

Thanks!

Charlie Ward

Charlie Ward 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

At the top of the case study detail page:

if (!perch_member_logged_in()) {
     PerchSystem::redirect('/casestudies');
}

Brilliant, thanks very much Drew!