"DO NOT" restrict messages to buyers only but make buyers unable to contact vendor first

Hi,
I do not want to restrict messages to buyers only but I want to make buyers unable to contact vendor first.
Here is the workflow

  1. Buyer views listing
  2. Buyer is unable to send host a message
  3. Buyer sends a booking request
  4. Vendor sees booking request but wants to get more information about the booking before accepting the booking request. Vendor is able to message buyer to get more information about the booking
  5. Buyer sees message. Buyer messages the vendor back
  6. After exchanging some messages, vendor is now comfortable with the details and accepts the booking request
  7. Buyer makes the payment.

I figured out that the easiest way to do this will be to hide the two “send message” buttons from the listing page and also from the host profile but I do not know how to do that. how can I do that?

Is there any easier and more efficient way to achieve this?

Thanks for your suggestion, this makes more sense than the current global restriction, we’ll try to add more options regarding this in the upcoming Messages/Marketplace updates.

Thanks for your feedback. Any code snippets available to hide the send message button from the buyer? Hide it from the listing page and from the vendor profile

Hi,

Please try this PHP snippet:

add_filter('hivepress/v1/templates/listing_view_block/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/listing_view_page/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/vendor_view_block/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/vendor_view_page/blocks', 'custom_remove_message_button', 1000, 2);

function custom_remove_message_button($blocks, $template){
	$context = strpos(current_filter(), 'listing') !== false ? 'listing' : 'vendor';
	
	$model = $template->get_context($context);
	
	if(!is_user_logged_in() || ('listing' === $context && get_current_user_id() !== $model->get_vendor__id()) || ('vendor' === $context && get_current_user_id() !== $model->get_id())){
		hivepress()->template->fetch_block($blocks, 'message_send_link');	
	}
	
	return $blocks;
}

Hi @andrii , thanks for the help. However, this snippet causes a fatal issue. The multiplier function stops working when a buyer selects multiple timeslots. See screenshot. I have selected 4 timeslots but the price is stuck at $150 instead of $600 on the listing view block (page primary) See screenshot.

The real price of $600 is updated on the booking request form but i also need it to be updated on the listing view block (page primary) See screenshot

Please try this PHP snippet instead

add_filter('hivepress/v1/templates/listing_view_block/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/listing_view_page/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/vendor_view_block/blocks', 'custom_remove_message_button', 1000, 2);
add_filter('hivepress/v1/templates/vendor_view_page/blocks', 'custom_remove_message_button', 1000, 2);

function custom_remove_message_button($blocks, $template){
	$context = strpos(current_filter(), 'listing') !== false ? 'listing' : 'vendor';
	
	$model = $template->get_context($context);
	
	if(!$model){
		return $blocks;
	}
	
	if(!is_user_logged_in() || ('listing' === $context && get_current_user_id() !== $model->get_vendor__id()) || ('vendor' === $context && get_current_user_id() !== $model->get_id())){
		hivepress()->template->fetch_block($blocks, 'message_send_link');	
	}
	
	return $blocks;
}
1 Like

It would be great for the administrator to see the internal messages of the users and providers remaining in draft status. And once the administrator sees them, he can publish them.

There’s no such option yet, but you can enable Message monitoring to view all the sent messages and ban users violating the website terms.

Voucher

And how did you enable that option?

If you mean monitoring you can enable this in HivePress/Settings/Messages.

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