Thanks to earlier help, I was able to use the provided code snippet to prevent user who has not booked a property from leaving a review. Now I am I just trying to figure out how to change the error message. I tried to change it here in the code snippet, but it does not seem to have any affect. Regardless of what I change it to it always reads like the below picture, which is what is in the code snippet. Thanks.
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
);