Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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 ?

    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)

    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
    (
    )

    Hi,
    I have exatly the same issue. It’s not possible to create/add any page once the plugin is activated. Once deactivated, then it’s possible to create a new page again.
    Note that it is possible to create an article ! So, the issue is only for pages.
    Wordpress 3.9.2
    Advanced Page Manager 1.3
    latests releases of plugins installed :
    Contact Form 7
    Contact Form DB
    BackWPup

    Thread Starter wpwcm

    (@wpwcm)

    the only solution I found is to put an exit(); before the “return $formData;”
    then, in that case, it’s not saving the info.

    but i found this solution inelegant ?

    Thread Starter wpwcm

    (@wpwcm)

    Thank you Michael for your time.

    About regex, I’m used to use # instead of / since a long time (result is the same).
    Forgetting the ” for vars was definitely a bad writing (I did correct that).

    Sorry, I realize that i didn’t explain well the issue.
    data was corrected/changed well and saved.

    if i do the $formData->posted_data = null; then it’s cleaning the data from the form, but the form is still saving the “Submitted” the “Submitted Login” and “Submitted From” datas (all the others being empty).
    If data is ok, i want to keep these 3 submitted fields. but when it’s not ok, then i want nothing to be saved as it seems that $formData is not the only things saved (the three other fields).
    doing then $formData->posted_data[‘Submitted’] = “”; is deleting the value.
    but doing $formData->posted_data[‘Submitted Login’] = null;
    $formData->posted_data[‘Submitted From’] = null;
    doesn’t delete the values. and thus a new record is saved

    Thread Starter wpwcm

    (@wpwcm)

    Thanks for helping 🙂

    function chkValues($formData) {
    // Change $formData
    if (isset($formData->posted_data[brochure_firstname])) {
    $formData->posted_data[brochure_firstname]=ucfirst(strtolower(safe_sql($formData->posted_data[brochure_firstname])));
    $formData->posted_data[brochure_email]=strtolower(safe_sql($formData->posted_data[brochure_email]));
    $formData->posted_data[brochure_name]=strtoupper(safe_sql($formData->posted_data[brochure_name]));
    $formData->posted_data[brochure_phone]=preg_replace(“#[^0-9]+#”,””,safe_sql($formData->posted_data[brochure_phone]));
    } else {
    $formData->posted_data[subscribe_email]=preg_replace(“#[^0-9a-z@\._\-]+#i”,””,strtolower(safe_sql($formData->posted_data[subscribe_email])));
    if (!filter_var($formData->posted_data[subscribe_email], FILTER_VALIDATE_EMAIL)) {
    $formData->posted_data[subscribe_email]=””;
    }
    }
    $formData->posted_data[‘uri’] = $_SERVER[‘REQUEST_URI’];
    return $formData; // be sure to return it
    }

    Thread Starter wpwcm

    (@wpwcm)

    Thanks.
    The weird thing is that if i set up to null either the $formData->title (even doing unset($formData->title);) of the form or the return value, then it saves a value.

    i’ve playing around with the array described in the doc without success in my chkValues :
    $formData = (object) array(
    ‘submit_time’ => 1339365804.7815, // float Unix timestamp with microseconds
    ‘ip’ => ‘192.168.1.1’, // string IP address
    ‘user’ => ‘admin’, // string user name if submitter was logged in. May be null
    ‘title’ => ‘Form name string’,
    ‘posted_data’ => array(/* key=>value for each field in the form */),
    ‘uploaded_files’ => null
    );

    I’m doing something wrong but don’t find what….

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