Only showing content if page is protected
-
Hi is there a way to only show content on pages which have been protected? I need to add a side nav but it should only appear on protected pages and not on public pages. Even if the site visitor is logged in, that side nav should still not appear on pages that haven’t been ticked with the “Yes, Protect this content.” button in the page editor.
As far as I can see I can only check if someone is logged in with:
if(SwpmMemberUtils::is_member_logged_in()) { $auth = SwpmAuth::get_instance(); $accstatus = $auth->get('account_state'); if($accstatus !== 'expired' && $accstatus !== 'inactive'){ echo 'show content'; } }
what I really need is something like this:
if(SwpmMemberUtils::is_member_logged_in()) { $auth = SwpmAuth::get_instance(); $accstatus = $auth->get('account_state'); if($accstatus !== 'expired' && $accstatus !== 'inactive'){ if(page_is_protected()){ echo 'show content'; } } }
Thanks
https://www.ads-software.com/plugins/simple-membership/
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Only showing content if page is protected’ is closed to new replies.