Hi Dave,
Having the same problem and can’t find any posts regarding the Parent pages having restrictions and wanting the Child pages to follow the same restriction of the Parent page, I did the following code clip when the child page is viewed as a single page:
I added this to my functions.php
function s2member_current_user_have_access($post_ID=0){
global $post;
$tmppost=$post;
$allow=true;
if ($post_ID==0){
$post_ID=$post->ID;
}
while($post_ID){
$thispost=get_post($post_ID);
if (!is_permitted_by_s2member($thispost->ID)){
$allow=false;
}
$post_ID=$thispost->post_parent;
}
$post=$tmppost;
return $allow;
}
?>
This will check the current page as well as the parent pages (if any) if they where restricted by S2member. The function will return true if the current user can access the child page. False if not.
Then I added this simple check on the header.php to redirect the user to the S2Member Membership Options Page if they don’t have access to the page. This is added before the “<!DOC TYPE html….." of the header.php
<?php
if (is_single()){
if (!s2member_current_user_have_access()){
header("Location: ".S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
}
}
?>
In fact, this little code clip and function can work on even posts and custom post types.