|WP_Error QuickStart result, or an error. */ function wpbc_booking_modes_run_rental_quickstart() { $state = wpbc_booking_modes_get_quickstart_state( 'rental' ); $resource_id = wpbc_booking_modes_quickstart_get_first_resource_id(); if ( is_wp_error( $resource_id ) ) { return $resource_id; } if ( empty( $state['profile_version'] ) ) { wpbc_booking_modes_quickstart_apply_rental_profile(); $state['profile_version'] = 1; $profile_state_result = wpbc_booking_modes_set_quickstart_state( 'rental', $state ); if ( is_wp_error( $profile_state_result ) ) { return $profile_state_result; } } $property_page = wpbc_booking_modes_quickstart_ensure_page( 'rental_property_booking', 'wpbc-rental-booking', __( 'Book a Property', 'booking' ), '[booking resource_id=' . absint( $resource_id ) . ']', '[booking resource_id=' . absint( $resource_id ) ); if ( is_wp_error( $property_page ) ) { return $property_page; } $search_page = array(); if ( class_exists( 'wpdev_bk_biz_l' ) && shortcode_exists( 'bookingsearch' ) ) { $search_page = wpbc_booking_modes_quickstart_ensure_page( 'rental_availability_search', 'wpbc-rental-search', __( 'Search Property Availability', 'booking' ), '[bookingsearch]', '[bookingsearch' ); if ( is_wp_error( $search_page ) ) { return $search_page; } } $state['completed'] = true; $state['completed_at'] = ! empty( $state['completed_at'] ) ? $state['completed_at'] : current_time( 'mysql' ); $state['resource_id'] = absint( $resource_id ); $state['page_id'] = absint( $property_page['page_id'] ); $state['search_page_id'] = ! empty( $search_page['page_id'] ) ? absint( $search_page['page_id'] ) : 0; $state_result = wpbc_booking_modes_set_quickstart_state( 'rental', $state ); if ( is_wp_error( $state_result ) ) { return $state_result; } return array( 'mode_id' => 'rental', 'message' => __( 'Rental QuickStart is ready. Review capacity, pricing, extras, and availability, then test the booking page.', 'booking' ), 'test_url' => $property_page['test_url'], 'page_id' => absint( $property_page['page_id'] ), 'resource_id' => absint( $resource_id ), 'search_url' => ! empty( $search_page['test_url'] ) ? $search_page['test_url'] : '', 'capacity_url' => wpbc_booking_modes_get_canonical_page_url( 'wpbc-resources__capacity' ), 'pricing_url' => wpbc_booking_modes_get_canonical_page_url( 'wpbc-prices__cost' ), 'availability_url' => wpbc_booking_modes_get_canonical_page_url( 'wpbc-availability__availability' ), ); }