Hook to limit entry viewing based on user role

Hi,

I’ve been looking (and struggling) to find an appropiate Gravity Hook to use for a customization I would like to make in the backend of my Quotation Portal Site.

I currently have 4 forms on the site.

Ultimately, I want for a specific user role, being “TTL Approver” to only see one of the forms and its entries that show under “Switch Form” (please see below) and not the others.
The form that I want them to be able to see is “Post Processor - Quote Form”. The ID of this form is 26

I’ve made a similar customization for GravityFlow which worked well:

add_filter( ‘gravityflow_status_filter’, ‘sh_gravityflow_status_filter’ );

function sh_gravityflow_status_filter( $filter_constraints ) {

$user = wp_get_current_user();

if ( in_array( 'dmg', (array) $user->roles ) ) {

	$filter_constraints = array(
		'form_id'    => 26,
	);
}

else if ( in_array( 'ttl-approver', (array) $user->roles ) ) {

	$filter_constraints = array(
		'form_id'    => 26,

	);
}


return $filter_constraints;

}

If anyone could help point in the right direction for this it would be much appreciated!

Many thanks! :slight_smile:

It sounds like this plugin may be what you need:

3 Likes