• Resolved ladom93210

    (@ladom93210)


    Hi,

    I created a form with a checkbox the user has to check if he’s willing to recommend us to other customers.
    But it does not work.
    I tested it as a user on the website : I can check it and validate the form, but when I go to the WordPress interface to see it in “all testimonials” in edit mode, the box is not checked.
    Could you please help?

Viewing 15 replies - 1 through 15 (of 22 total)
  • anonymized-13171256

    (@anonymized-13171256)

    I need your help to diagnose the problem.

    Add this to your theme’s functions.php file:

    function my_new_testimonial( $post, $meta, $cats, $att ) {
    	ob_start();
    	print_r( $_POST );
    	print_r( func_get_args() );
    	$text = ob_get_clean();
    
    	$headers = 'MIME-Version: 1.0' . "\n";
    	$headers .= 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"' . "\n";
    	$headers .= 'From: ' . get_option( 'admin_email' ) . "\n";
    
    	wp_mail( '[email protected]', 'Diagnostic for ' . get_option( 'blogname' ), $text, $headers );
    }
    add_action( 'wpmtst_new_testimonial_added', 'my_new_testimonial', 10, 4 );
    

    Then submit the form.

    That will send the raw form data and the processed result to me. If you want to send it to yourself first to check that it contains no sensitive information, simply change [email protected] to your email address then forward it to that address.

    Then I need to see a screenshot of the new testimonial (make sure it’s the one you just submitted) that shows at least the “Client Details” box (I recommend Snaggy or Jing). You can post a link to that here or send it to [email protected]. Firefox also makes it easy to take a full-page screenshot.

    If you prefer, instead of a screenshot, you can send me an export file. This plugin makes it easy to export a single post:
    https://ww.wp.xz.cn/plugins/single-post-exporter/
    After installing, go to Settings and check the box for “wpm-testimonial”. Then you will see an “export” link in the All Testimonials list.

    With that information, I will try to narrow down the problem.

    Thread Starter ladom93210

    (@ladom93210)

    Hi Chris,

    Could you specify into which folder is the functions.php file I have to add the code you sent?
    Is it in the wp-includes folder or in the strong testimonials folder?

    • This reply was modified 8 years, 8 months ago by ladom93210.
    anonymized-13171256

    (@anonymized-13171256)

    In your current theme. For example,

    wp-content/themes/twentyseventeen/functions.php

    Thread Starter ladom93210

    (@ladom93210)

    We added the code to the parent theme and the site does not work anymore, so I was not able to create a new testimonial.
    Here’s an excerpt to show you where exactly we added it in the parent theme’s function.php :

    require_once( SPACIOUS_ADMIN_DIR . ‘/meta-boxes.php’ );

    /** Load Widgets and Widgetized Area */
    require_once( SPACIOUS_WIDGETS_DIR . ‘/widgets.php’ );

    /**
    * Detect plugin. For use on Front End only.
    */
    include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ );

    /**
    * Load Demo Importer Configs.
    */
    if ( class_exists( ‘TG_Demo_Importer’ ) ) {
    require get_template_directory() . ‘/inc/demo-config.php’;
    }

    /**
    * Assign the Spacious version to a variable.
    */
    $theme = wp_get_theme( ‘spacious’ );
    $spacious_version = $theme[‘Version’];

    /* Calling in the admin area for the Welcome Page */
    if ( is_admin() ) {
    require get_template_directory() . ‘/inc/admin/class-spacious-admin.php’;
    }
    /**
    * Load TGMPA Configs.
    */
    require_once( SPACIOUS_INCLUDES_DIR . ‘/tgm-plugin-activation/class-tgm-plugin-activation.php’ );
    require_once( SPACIOUS_INCLUDES_DIR . ‘/tgm-plugin-activation/tgmpa-spacious.php’ );

    function my_new_testimonial( $post, $meta, $cats, $att ) {
    ob_start();
    print_r( $_POST );
    print_r( func_get_args() );
    $text = ob_get_clean();

    $headers = 'MIME-Version: 1.0' . "\n";
    $headers .= 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . '"' . "\n";
    $headers .= 'From: ' . get_option( 'admin_email' ) . "\n";

    wp_mail( '[email protected]', 'Diagnostic for ' . get_option( 'blogname' ), $text, $headers );
    }
    add_action( 'wpmtst_new_testimonial_added', 'my_new_testimonial', 10, 4 )

    • This reply was modified 8 years, 8 months ago by ladom93210.
    anonymized-13171256

    (@anonymized-13171256)

    Remove the code. I will have to create a simple plugin for it instead.

    Thread Starter ladom93210

    (@ladom93210)

    OK thanks !

    anonymized-13171256

    (@anonymized-13171256)

    anonymized-13171256

    (@anonymized-13171256)

    Thank you, I got the email.

    Are you on the latest plugin version 2.26.10?

    Thread Starter ladom93210

    (@ladom93210)

    Hi Chris,

    We installed your plugins then we added the code you sent earlier to the parent theme’s function.php : same result, the site is bugged when we add it.
    We tried and added the code to the child theme’s function.php instead, and it did not work either.

    anonymized-13171256

    (@anonymized-13171256)

    No longer necessary to add code to functions.php.

    Thread Starter ladom93210

    (@ladom93210)

    well, we tried without adding the code, but it still does not work : I created a testimonial and ticked the box, but in the wordpress interface when I see the testimonial, the checkbox is not checked.

    anonymized-13171256

    (@anonymized-13171256)

    We’re still diagnosing the problem. I received the diagnostic email.

    Are you on the latest version 2.26.10?

    Thread Starter ladom93210

    (@ladom93210)

    No, we are updating now and will try again.

    Thread Starter ladom93210

    (@ladom93210)

    Hi Chris,
    Our problem is still pending but I won’t be able to make the update until next week (my webmaster is off for the week). I keep you posted once it’s done.
    Regards,
    Laëtitia

    Thread Starter ladom93210

    (@ladom93210)

    Hi Chris,
    Just an update to tell you the checkbox is now working after we updated the plugin).
    Thanks for your help !

Viewing 15 replies - 1 through 15 (of 22 total)

The topic ‘Checkbox not working’ is closed to new replies.