Hide Label Contact Vendor on Booking Request level

Hi. In the Listing Hive Theme a User requests a Booking, then the Vendor has to approve the Request and turn it into a booking. We saw that the Vendor has a Tab to Contact the Vendor. This does not make sense as he himself is the Vendor. Is there a chance to hide this Button on on this level?

Please try this PHP snippet

add_filter(
	'hivepress/v1/templates/booking_view_page/blocks',
	function ($blocks, $template){
		$booking = $template->get_context('booking');
		
		if(!$booking){
			return $blocks;
		}
		
		$listing = $booking->get_listing();
		
		if(!$listing){
			return $blocks;
		}
		
		$vendor = $listing->get_vendor();
		
		if(!$vendor){
			return $blocks;
		}
		
		if(get_current_user_id() !== $vendor->get_user__id()){
			return $blocks;
		}
		
		return hivepress()->helper->merge_trees(
					[ 'blocks' => $blocks ],
					[
						'blocks' => [
							'message_send_link' => [
								'type' => 'content',
							]
						],
				]
				)['blocks'];
	},
	1000,
	2
);
1 Like