How to edit the review error message

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 
);

Hi,

Please try to change this string using Loco Translate. You can find this string in Loco Translate Plugins > HivePress Marketplace (How to translate an extension - HivePress Help Center).

Thanks for this code, i changed the message in the code and it worked, thanks so much.

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