Hello there,
first and foremost, I’m enjoying the features and the easy of use of taskhive! so great work!
I have a question though, I don’t want general users to add reviews to services or vendors if they didn’t actually buy the service from this vendor.
Can it be done? Any advice?
Thank you
yana
August 25, 2022, 4:56pm
4
Thanks!
Yes, if you’ve installed Marketplace, please check the “Restrict reviews to buyers” option in HivePress>Settings>Orders section.
Is there an option to do same restriction with bookings plugin instead of marketplace? As we use Booking plugin only, as Marketplace redirects to WooCommerce, and bookings only plugin is better solution for us.
yevhen
September 14, 2022, 10:55am
8
Please try this PHP snippet
add_filter(
'hivepress/v1/models/review/errors',
function ( $errors, $review ) {
if ( empty( $errors ) && hivepress()->get_version('bookings') ) {
// Get listing.
$listing = $review->get_listing();
if ( $listing && hivepress()->booking->is_booking_enabled( $listing ) ) {
// Get booking.
$booking = HivePress\Models\Booking::query()->filter(['listing' => $listing->get_id(), 'user' => get_current_user_id(), 'status__in' => hivepress()->booking->get_blocked_statuses()])->get_first_id();
if ( !$booking ) {
$errors[] = 'Only buyers can submit reviews';
}
}
}
return $errors;
},
1000,
2
);
1 Like
system
Closed
October 14, 2022, 10:56am
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.