Action hook to control access to certain parts of my site

Put this at the very top of your page.php file, before the get_header() call:

<?php
    // redirect if user isn't logged in
    if( ! is_user_logged_in() ) {
        wp_safe_redirect( home_url( '/signup/' ) );
        exit;
    }

    // supply IDs of both parent pages
    $keys = array( '21', '23' );

    // check if user can access page
    foreach( $keys as $key )
    {
        // get parent page object
        $parent = get_page( $key );

        // add IDs of parent and children to array
        $pageids = array();
        $objs = get_pages( array( 'child_of' => $parent->ID ) );
        foreach( $objs as $obj ) $pageids[] = $obj->ID;
        $pageids[] = $key;

        if(
            // check if current page is restricted area
            in_array( get_queried_object_id(), $pageids )
            // and check if current user has appropriate meta
            && '1' !== get_user_meta( get_current_user_id(), $parent->post_name, true )
        ) {
            // redirect to signup page if conditions aren't met
            wp_safe_redirect( home_url( '/signup/?for=" . $parent->post_name ) );
            exit;
        }
    }
?>

Notes: (a) you”ll have to supply the correct page IDs for the $keys array on line 9, and (b) this code expects users to have user meta with key community1 (and/or community2), and value 1 if they have access.