Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Child theme functions
- *
- * When using a child theme (see http://codex.wordpress.org/Theme_Development
- * and http://codex.wordpress.org/Child_Themes), you can override certain
- * functions (those wrapped in a function_exists() call) by defining them first
- * in your child theme's functions.php file. The child theme's functions.php
- * file is included before the parent theme's file, so the child theme
- * functions would be used.
- *
- * Text Domain: oceanwp
- * @link http://codex.wordpress.org/Plugin_API
- *
- */
- /**
- * Load the parent style.css file
- *
- * @link http://codex.wordpress.org/Child_Themes
- */
- function oceanwp_child_enqueue_parent_style() {
- // Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)
- $theme = wp_get_theme( 'OceanWP' );
- $version = $theme->get( 'Version' );
- // Load the stylesheet
- wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );
- }
- add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );
- add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' );
- function my_comment_form_field_comment( $comment_field ) {
- return $comment_field.'<p class="pprivacy"><label for="pprivacy"><input type="checkbox" style="width:30px" name="privacy" value="Privacidad Aceptada" class="privacyBox" aria-req="true">He leido y acepto <a target="blank" href="https://www.monetizados.com/privacidad/">la política de privacidad</a></label><p>';
- }
- //javascript validation
- add_action('wp_footer','valdate_privacy_comment_javascript');
- function valdate_privacy_comment_javascript(){
- if (! is_admin() && is_single() && comments_open() ){
- wp_enqueue_script('jquery');
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $("#submit").click(function(e)){
- if (!$('.privacyBox').prop('checked')){
- e.preventDefault();
- alert('Debes confirmar que estás de acuerdo con nuestra política de privacidad marcando la "cajita" ....<p><a href="javascript:history.back()">' . __('« Volver') . '</a></p>');
- return false;
- }
- }
- });
- </script>
- <?php
- }
- }
- //no js fallback validation
- add_filter( 'preprocess_comment', 'verify_comment_privacy' );
- function verify_comment_privacy( $commentdata ) {
- if ( ! isset( $_POST['privacy'] ) && ! is_admin() )
- wp_die( __( 'Error: Debes confirmar que estás de acuerdo con nuestra política de privacidad marcando la "cajita" ..... <p><a href="javascript:history.back()">' . __('« Volver') . '</a></p>' ) );
- return $commentdata;
- }
- // Guardamos el valor aceptado en la tabla comment metadata
- function save_comment_meta_data ( $post_id ) {
- $privacy_comment = $_POST['privacy'];
- if ( $privacy_comment ) {
- add_comment_meta( $post_id, 'privacy', $privacy_comment, true );
- }}
- add_action( 'comment_post', 'save_comment_meta_data', 1 );
- // Mostramos el valor del metadato en la página de administración de comentarios
- if ( is_admin() ) {
- function show_commeta() {
- echo get_comment_text(), '<br><br><strong>', get_comment_meta(get_comment_ID(), 'privacy',1), '<strong>';
- }
- add_action('comment_text', 'show_commeta');
- }
- function hormi_change_note_after_comment_form($arg) {
- $arg['comment_notes_after'] = '<p class="comment-notes">Responsable: Monetizados online SL, siendo la Finalidad; envío de mis publicaciones así como correos comerciales. La Legitimación; es gracias a tu consentimiento. Destinatarios: tus datos se encuentran alojados en mis plataformas de email marketing Active Campaign ubicada en EEUU y acogida al Privacy Shield. Podrás ejercer Tus Derechos de Acceso, Rectificación, Limitación o Suprimir tus datos en contacto@monetizados.com. Para más información consulte nuestra <a target="blank" href="https://www.monetizados.com/privacidad/">política de privacidad</a>;
- return $arg;
- }
- add_filter('comment_form_defaults', 'hormi_change_note_after_comment_form');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement