diff --git a/inc/admin/settings/property.php b/inc/admin/settings/property.php index 3ab8aeba..e0205432 100755 --- a/inc/admin/settings/property.php +++ b/inc/admin/settings/property.php @@ -334,6 +334,18 @@ class Opalestate_Settings_Property_Tab extends Opalestate_Settings_Base_Tab { private function get_subtab_detail_fields() { $fields = []; + $fields[] = [ + 'name' => esc_html__( 'Enable Request Viewing', 'opalestate-pro' ), + 'desc' => esc_html__( 'Enable Request Viewing feature in the single property page.', 'opalestate-pro' ), + 'id' => 'enable_single_request_viewing', + 'type' => 'switch', + 'options' => [ + 'on' => esc_html__( 'Enable', 'opalestate-pro' ), + 'off' => esc_html__( 'Disable', 'opalestate-pro' ), + ], + 'default' => 'on', + ]; + $fields[] = [ 'name' => esc_html__( 'Show Amenities tab', 'opalestate-pro' ), 'desc' => esc_html__( 'Show Amenities tab in the single property page.', 'opalestate-pro' ), diff --git a/inc/class-opalestate-install.php b/inc/class-opalestate-install.php index 19768a24..bed36653 100755 --- a/inc/class-opalestate-install.php +++ b/inc/class-opalestate-install.php @@ -108,6 +108,7 @@ class Opalestate_Install { $options[ OPALESTATE_PROPERTY_PREFIX . 'areasize_opt_v' ] = 'on'; $options[ OPALESTATE_PROPERTY_PREFIX . 'price_opt_v' ] = 'on'; + $options['enable_single_request_viewing'] = 'on'; $options['enable_single_amenities'] = 'on'; $options['enable_single_facilities'] = 'on'; $options['enable_single_attachments'] = 'on'; diff --git a/inc/template-hook-functions.php b/inc/template-hook-functions.php index fd938f55..6d15ae61 100755 --- a/inc/template-hook-functions.php +++ b/inc/template-hook-functions.php @@ -218,6 +218,10 @@ add_action( 'opalestate_single_property_preview', 'opalestate_property_preview', function opalestate_property_request_viewing_button( $islink = false ) { + if ( 'on' != opalestate_get_option( 'enable_single_request_viewing', 'on' ) ) { + return; + } + $class = $islink ? 'btn-link' : 'btn btn-primary'; if ( ! is_user_logged_in() ) { $class .= ' opalestate-need-login'; @@ -260,6 +264,10 @@ add_action( 'opalestate_single_property_layout', 'opalestate_single_property_lay * Forms */ function opalestate_property_request_view_form() { + if ( 'on' != opalestate_get_option( 'enable_single_request_viewing', 'on' ) ) { + return; + } + if ( ! is_user_logged_in() ) { return; }