Join our new community forum for support & discussion

Join Now

Home Support General HivePress Messages only between Hosts

Messages only between Hosts

  • Author
    Posts
  • DianaLizarazo

    Hi!

    How are you? I activated the option to enable to send messages only after booking. However, I wonder if is possible to allow only hosts to exchance messages among them even if they do not book each other

    Thanks!

    yevhen developer

    Please try this PHP snippet

    add_filter(
    	'hivepress/v1/templates/listing_view_page',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    
    add_filter(
    	'hivepress/v1/templates/listing_view_block',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    
    add_filter(
    	'hivepress/v1/templates/vendor_view_block',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    
    add_filter(
    	'hivepress/v1/templates/vendor_view_page',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    
    add_filter(
    	'hivepress/v1/templates/booking_view_block',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    
    add_filter(
    	'hivepress/v1/templates/booking_view_page',
    	function ($template){
    		if(!current_user_can('edit_posts')){
    			$template = hivepress()->helper->merge_trees(
    				$template,
    				[
    					'blocks' => [
    						'message_send_link' => [
    							'type'   => 'content',
    						],
    					],
    				]
    			);
    		}
    		
    		return $template;
    	},
    	1000
    );
    DianaLizarazo

    Hola Yevhen,

    Thanks for trying but it did not work, I set up three different hosts accounts (doing all the precess of registering as normal users would do it) and they cannot send messages among themselves if the option of sending message only for buyers is activated. Do I need to change something in that snippet to make it work?

    I will highly appreciate it!

    ihor developer

    Sorry, there was a misunderstanding – there’s no simple code snippet for this, the “Restrict messages to buyers” option hides all the Send Messages buttons and links and leaves them on the order and booking pages only, adding an exception for hosts would require further customizations.

    DianaLizarazo

    Hi Ihor,

    Thank you for the clarification. I have another question for you. When I activated the restrict to buyers option I noticed that literally only buyers can send messages. Not even the hosts after accepting the bookings. I still have not completed the installation of the payment methods on my website to test what happens after the payment but now I am wondering if after receiving the payment hosts will also be able to send messages.

    Thanks!

    ihor developer

    Please make sure that the order is marked as Processed or Completed, then both buyers and vendors should be able to exchange messages.

    DianaLizarazo

    Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)

New Reply

This forum has been archived and is no longer accepting new posts or replies. Please join our new community forum for support & discussion.