Allow hosts to view a guest's account when a booking is requested

My hosts want to be able to view a guest’s account when a booking is requested. I have some custom fields that hosts need to have visibility of. How can I make this possible?

Please try this PHP code snippet as a temporary solution. But please note that it can require further customization. If you are not familiar with the code customization, then please consider hiring someone for custom work https://fvrr.co/32e7LvY

add_filter(
	'hivepress/v1/templates/booking_view_page/blocks',
	function($blocks, $template){
		if(!get_option('hp_user_enable_display')){
			return $blocks;
		}
		
		$listing = $template->get_context('listing');
		
		if(!$listing){
			return $blocks;
		}
		
		$vendor = $listing->get_vendor();
		
		if(!$vendor || get_current_user_id() !== $vendor->get_user__id()){
			return $blocks;
		}
		
		return hivepress()->template->merge_blocks(
			$blocks,
			[
				'booking_sidebar' => [
					'blocks' => [
						'custom_booking_user_block' => [
							'type'     => 'template',
							'template' => 'user_view_block',
							'_order'   => 30,
						],
					],
				],
			],
		);
	},
	1000,
	2
);
2 Likes