From bba496d1a1c6e42a5be7e1f600858973996eea47 Mon Sep 17 00:00:00 2001 From: Rizzamel De Oro Date: Fri, 19 Jul 2024 08:17:54 +0800 Subject: [PATCH] Action the comments from user in support forum ( free features ) --- admin/comment_form_admin.php | 5 ++-- admin/views/fields.php | 36 ++++++++++++++++++++++++++++ admin/views/text.php | 30 +++++++++++++++++++++++ frontend/comment_form_frontend.php | 38 ++++++++++++++++++++++++++++++ inc/comment_form_main.php | 4 ++++ 5 files changed, 111 insertions(+), 2 deletions(-) diff --git a/admin/comment_form_admin.php b/admin/comment_form_admin.php index 3701102..f55cce5 100644 --- a/admin/comment_form_admin.php +++ b/admin/comment_form_admin.php @@ -184,8 +184,9 @@ public function register_settings() { */ public function sanitize_settings ( $data ){ - $data['text_before'] = wp_kses_post( $data['text_before'] ); - $data['text_after'] = wp_kses_post( $data['text_after'] ); + $data['text_before'] = wp_kses_post( $data['text_before'] ); + $data['text_after'] = wp_kses_post( $data['text_after'] ); + $data['cookies_text'] = wp_kses_post( $data['cookies_text'] ); return $data; } diff --git a/admin/views/fields.php b/admin/views/fields.php index d93aaaf..3a19f2a 100644 --- a/admin/views/fields.php +++ b/admin/views/fields.php @@ -30,6 +30,14 @@ public function sc_settings_fields() { 'comment-form-fields', 'comment_form_fields_section' ); + + add_settings_field( + 'commentform_settings_remove_cookies', + __('Remove consent field', 'commentform'), + array($this, 'render_remove_cookies_field_callback'), + 'comment-form-fields', + 'comment_form_fields_section' + ); } /** @@ -104,6 +112,34 @@ public function render_remove_email_field_callback() { ?>

+ generate_checkbox( + 'commentform_settings[remove_cookies]', + '1', + checked(1, $this->options('remove_cookies'), false), + false, + 'Remove consent field' + ); + ?> +

+ generate_checkbox( + 'commentform_settings[remove_cookies_css]', + '1', + checked(1, $this->options('remove_cookies_css'), false), + false, + 'Remove consent field with css' + ); + ?> +

+

+ generate_checkbox( + 'commentform_settings[cookies_consent]', + '1', + checked(1, $this->options('cookies_consent'), false), + false, + 'Remove consent default text' + ); + ?> +

+

+ + +

+ options(); + + // Print custom consent text. + if (isset($options['cookies_text']) && $options['cookies_text'] !== '') { + echo ""; + } + } + /** * action to trigger after the fields (username, email, url) where displayed * @@ -165,6 +198,11 @@ public function footer_output() { if ($options['remove_email_css']) { echo ""; } + // css code to hide the consent field + // .comment-form-cookies-consent as in the default comment form in /wp-includes/comment-template.php + if ($options['remove_cookies_css']) { + echo ""; + } // apply styles for two columns comment form layout if ($options['two_columns'] && !is_user_logged_in()) { echo '