We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Members

Possible to secure blog content with members app?

I'm contemplating using the members app for some secured content on an upcoming project and haven't used it before. I know it sounds like a horrible idea but can you secure the blog behind the member login?

Can you choose which pages are accessible to logged in members in the admin or does it involve adding something like the following to member only pages?

Presumably this can be added to blog pages too?

    if (perch_member_logged_in()) {
        perch_content('Private members intro');
        perch_content('Files for members');
    }else{
        perch_content('Login instructions');
        perch_members_login_form();
    }

How would this work in Runway pages?

I got the above snippet from the Nest demo which I installed locally... can't find the member logout button though!? Thanks!

Adam Green

Adam Green 0 points

  • 3 years ago

I can't say for sure, but that should work if you place your blog page code inside the if (perch_member_logged_in()).

For the logout button, I think you need to create your own. Just make a logout.php with this code:

<?php 
include('path-to-perch/runtime.php');
perch_member_log_out(); 
PerchUtil::redirect('/page-to-redirect-to');
?>
Drew McLellan

Drew McLellan 2638 points
Perch Support

As Shane says, that should work.

Terrific thanks guys