Skip to content
Open
10 changes: 10 additions & 0 deletions includes/Dashboard/Templates/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,16 @@
}
}

// Validate Terms & Conditions: if enabled, content must not be empty.
$enable_tnc = sanitize_text_field( wp_unslash( $_POST['dokan_store_tnc_enable'] ?? '' ) ) === 'on';
if ( $enable_tnc ) {
$store_tnc = wp_strip_all_tags( wp_unslash( $_POST['dokan_store_tnc'] ?? '' ) );

if ( empty( trim( $store_tnc ) ) ) {
$error->add( 'dokan_tnc_content', esc_html__( 'Please add Terms & Conditions content before save the settings.', 'dokan-lite' ) );
}
}

if ( $error->get_error_codes() ) {
return $error;
}
Expand Down Expand Up @@ -864,7 +874,7 @@
*
* @return string
*/
public function get_method_frontend_title( $title, $method ) {

Check warning on line 877 in includes/Dashboard/Templates/Settings.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

The method parameter $method is never used
if ( 0 === stripos( $title, 'Dokan ' ) ) {
return substr( $title, 6 );
}
Expand Down
Loading