Add 'attribute descriptions' to listing Title and Location

Listhive message issue.

Is it possible to enable a subscriber to message a vendor only when they purchase a subscription - which is then allocated to the vendor listing to which the message relates?

In practice this means the user would be able to view any listing but would have to pay a subscription to able to message the vendor about the particular listing they want to enquire about. The subscription would allow unlimited messages about that listing; but would not allow messaging about (from) another listing.

I started to look into possible coding and started with this psuedo code:

Action hook = when user attempts to send a message about (from) a listing.

If the user has purchased a subscription product that is not allocated to any listing or is allocated to the current listing 1
If the subscription product is not allocated
allocate the subscription product to the current listing ()
end
send the users message (i.e. return true?)
else
Call the buy subscription product dialog (woo)
if the user buys the subscription product
allocate the subscription product to the current listing ()
send the users message (i.e. return true ?)
else
return false
end
end

allocate subscription product()
flag one of the users unallocated subscription products with the current listing ID()
return

  1. New custom field in the woo product purchase (order) record? – Listing ID

I looked at the messaging plugin and found this code in class-message.php

	// Get listing.
	if ( $form->get_value( 'listing' ) ) {
		$listing = Models\Listing::query()->get_by_id( $form->get_value( 'listing' ) );

		if ( ! $listing || $listing->get_status() !== 'publish' ) {
			return hp\rest_error( 400 );
		}
	}

This seems like the obvious place to validate the message for the required subscription. The logic of accept / refuse would (as Ihor confirmed) be the same as the logic in the subscription extension (i.e “reveal” concealed contact info.)

Has anyone else coded this functionality already ?

TIA
Richard

Sorry, there’s no simple code snippet for this, it would require a custom implementation. But we’re working on the advanced extension for monetization features in HivePress (based on feedback we collected for 2 years), and hope to release it soon

If it is urgent then please consider hiring someone for custom work https://fvrr.co/32e7LvY

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