• Resolved wpwcm

    (@wpwcm)


    Hello,

    I have 2 specifics forms (not using any form plugin).
    Until few weeks, they were working 100% fine. Now, they are not saving datas anymore.
    I do not remember to have done any change in the code since. The only thing that could have been done is updating some extensions.

    the plugin is still active (i’ve tried to deactivate and then reactivate again).
    the form page are still containing [cfdb-save-form-post].
    there is noting in options that could say ‘do not save’

    any idea to track from where it could come ?

    Thank you

    https://wordpress.org/plugins/contact-form-7-to-database-extension/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    I don’t know the the problem is. Here are some thoughts.

    1. Be sure that there is a field called “form_title” in your form. Otherwise the submissions will appear under the form name “untitled”. Example: <input type="hidden" name="form_title" value="Your form title"/>

    2. Be sure the [cfdb-save-form-post] short code is on the page that the form posts to (which may not be the same as where the form is)

    3. To try to debug, edit the plugin file named CFDBShortCodeSavePostData.php. Locate this code:

    public function handleShortcode($atts, $content = null) {
    
    //        echo '<pre>';
    //        print_r($_POST);
    //        echo "\n";
    //        print_r($_FILES);
    //        echo '</pre>';

    Change it to:

    public function handleShortcode($atts, $content = null) {
    
            if (is_array($atts) && isset($atts['debug']) && $atts['debug'] == 'true') {
                echo '<pre>';
                print_r($_POST);
                echo "\n";
                print_r($_FILES);
                echo '</pre>';
            }

    then in your post use the short code [cfdb-save-form-post debug="true"]

    Now the short code will print on your page all the information posted from the form that it sees. What does it print after you submit the form?

    Thread Starter wpwcm

    (@wpwcm)

    Thank you for your response and the hack in the code to display the info 🙂

    it displays all the info in my form fine :

    Array
    (
        [user_info_nonce] => 7534f23fce
        [_wp_http_referer] => /infos/test
        [form_title] => test
        [test_book] => Array
            (
                [0] => book1
            )
    
        [test_name] => MYNAME
        [test_firstname] => myfirstname
        [test_phone] => 457898
        [test_email] => myemail@mail.com
    )
    
    Array
    (
    )

    Plugin Author Michael Simpson

    (@msimpson)

    OK, that looks good.

    Let’s set it up to output errors to a file:

    Create a wp-content/plugins/contact-form-7-to-database-extension/php.ini file with an line that points to a where a log file should be written:
    error_log=/path/to/error_log.txt

    Submit a form and see if there is information in the file.

    Thread Starter wpwcm

    (@wpwcm)

    thanks. done, but nothing in the file.
    I even changed that : define( ‘WP_DEBUG’, true);

    note that the script is sending an email and the sending is working fine.
    and the return $formData; is still there too.

    i did create a very basic form and it’s saving the data 100% fine in the DB.
    so, there is something wrong in my enhanced form code.
    I guess i have to created it again, and test step by step, to understand at what moment it get bad.

    Thread Starter wpwcm

    (@wpwcm)

    ok. I found the issue; and hopefully, it could help somebody else.

    At the beginning of my script, i have 2 different “add_filter” with 2 functions.
    1st one is used to check values.
    2nd one is used to send an email with the values.

    I’m quite sure I had only 1 return $formData; at the end of the 1st add_filter and before, it was saving the data.
    Now, if i want the data to be saved, I have to add the “return $formData;” at the end of the 2nd function too and not only at the end of the 1st function (even if the second function is not necessary).

    does it make sense ?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘not saving anymore’ is closed to new replies.