Manually accept new booking are checked by default and hidden

Hello,

I’ve tried the snippet below to atomatically check “Manually accept new booking” and hide it, but it only hides that option but does not check it. Instead of “Request to book” it still shows “Book now”. I’ve tried other snippets from the previous postings, but nothing seems to work.

I would appreciate your help.

Thank you.

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		
		if ( isset($attributes['booking_moderated']) ) {
			$attributes['booking_moderated']['editable'] = false;
		}

		return $attributes;
	},
	1000
);

Hi,

Please refer to this topic How can I set a default value for a listing attribute and hide it from listing creation - #8 by tomp

I used the snipped below from the post you are referring to, but did not do anything.

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		
		if ( isset($attributes['booking_moderated']) ) {
			$attributes['booking_moderated']['editable'] = false;
		}

		return $attributes;
	},
	1000
);

Hi,

You must use these PHP snippets:

Hide the Booking Requests feature:

add_filter(
	'hivepress/v1/models/listing/attributes',
	function( $attributes ) {
		
		if ( isset($attributes['booking_moderated']) ) {
			$attributes['booking_moderated']['editable'] = false;
		}

		return $attributes;
	},
	1000
);

And set the Booking Requests by default:

add_action('hivepress/v1/models/listing/create', function($listing_id) {
	if(hivepress()->get_version( 'bookings' )){
		update_post_meta($listing_id, 'hp_booking_moderated', true);	
	}

},
1000
);

This worked. Thank you.

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