How can I password protect a page

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 4, 2016   (RSS)

By JeffC - April 26, 2016

I am using the membership plugin. I have two pages that I would like to make accessible to members only.

I my navigation I have used this to hide the links from anyone who is not logged in:

<?php if ($CURRENT_USER): ?>
<li><a href="/library-list.php" title="Library">Library</a></li>
<li><a href="/documents-list.php" title="Documents">Documents</a></li>
<?php endif ?>

The above stops a non-member from seeing the link and clicking on it. However, it doesn't stop a non-member from going directly to the page if they know the full url.  Eg www.domainname.co.uk/library-list.php is accessible to anyone.

How would I create a warning that says something like "you need to be a member to access this page" when someone attempts to access the page?

Thanks

Jeff

By JeffC - May 4, 2016

Thank you

Jeff