@noelawill – Sorry for the delay.
Ok so this is the code we use to redirect a page that they don’t have permission for.
https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L30-L34
You might be able to hack that into a filter of whether the form should render or not, but I’m honestly not sure how to tie that to the form post type properly so my guess is that directly wouldn’t be the solution.
That said if you made a new restriction that didn’t target content, but set the user permissions properly, you could theoretically duplicate our restriction check code, choose that restriction by index and skip the “content_check”
https://github.com/code-atlantic/content-control/blob/master/classes/Site/Restrictions.php#L48-L67
$restrictions = JP\CC\Options::get( 'restrictions' );
$restriced_content = false;
if ( ! $restrictions || empty( $restrictions ) ) {
return $restriced_content;
}
// first one in list I believe currently, in future they will have actual IDs.
$restriction = $restrictions[0];
$is_restricted = \JP\CC\Is::access_blocked( $restriction['who'], $roles, array( 'context' => 'content_restrictions' ) );
if ( $is_restricted ) {
// do stuff or don't.
}
Hope that helps, you’ll have to hack it into your stuff from there, but it should work in theory.