Restrict to only allow Submit Offer by Verified User

How do I restrict the offer to only allow Verified Vendors to submit offer and no one else?

Is there a Snippet for this or any other way?

Please try this PHP snippet

add_filter(
	'hivepress/v1/forms/offer_make/errors',
	function( $errors, $form ) {
		$vendor_id = \HivePress\Models\Vendor::query()->filter(
				[
					'verified' => true,
					'user' => get_current_user_id(),
					'status'       => 'publish',
				]
			)->get_first_id();
		if(!current_user_can('edit_posts') || !$vendor_id){
			$errors[] = 'Only verified vendors can post offer';
		}
		
		return $errors;
	},
	1000,
	2
);
3 Likes


It worked! Thank You!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.