• Resolved Kimantis_Creative_Group

    (@kimantis_creative_group)


    Hello, Any idea why the latest update would break my forms emails? Everything is empty on var_dump($form). Emails are going through no problem.

    add_action(‘acfe/form/submit/email/form=clients’, ‘my_form_submit’, 10, 3);
    function my_form_submit($form, $post_id){

    date_default_timezone_set(“America/Moncton”);

    $name = get_field(‘client_name’);
    $last = get_field(‘client_last_name’);
    $address = get_field(‘add_full_address’);
    $phone = get_field(‘client_phone’);
    $phonehome = get_field(‘client_home’);
    $followup = get_field(‘followup’);
    $followupmessage = sanitize_text_field( $followup[0][‘message’] );
    $dateposted = date(‘l jS \of F Y h:i:s A’);
    $add_clients = get_field(‘add_clients_email’, ‘option’);
    // Retrieve user input
    $status = get_field(‘job_status’);
    $orderplan = get_field(‘order_plan’);

    // Email 1
    if($status === ‘quote’){

    }

    } else{

    }

    }`

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback! You said “Emails are going through no problem”. Email are correctly sent and the content is okay?

    What kind of operation are you doing in that acfe/form/submit/email hook? I would suggest to use acf_log() instead of var_dump() to debug variables in hooks (to avoid break page headers and such). When using acf_log() the data is logged in the /wp-content/debug.log file (WP Debug Log must be enabled).

    Can you try to make a acf_log($form) & acf_log(get_field('client_name')) in your hook and check the result in the debug file?

    I’ll run some tests on my side too.

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I just checked and everything works fine. However, it looks like there is a problem in your code, since you using this hook with 3 arguments:

    add_action('acfe/form/submit/email/form=clients', 'my_form_submit', 10, 3);
    

    But your function only have 2:

    function my_form_submit($form, $post_id)
    

    Also you’re using the wrong arguments, the correct arguments are the following: $args, $form, $action. There is no $post_id.

    Please refer to the documentation for usage example: https://www.acf-extended.com/features/modules/dynamic-forms/e-mail-action#submit

    In your case:

    /*
     * E-mail Submit
     * 
     * @array   $args    Email arguments
     * @array   $form    Form settings
     * @string  $action  Action name
     */
    add_action('acfe/form/submit/email/form=clients', 'my_form_submit', 10, 3);
    function my_form_submit($args, $form, $action){
        
        acf_log($args);
        acf_log($form);
        acf_log(get_field('client_name'));
        
    }

    Hope it helps!

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I get back to you since that I stumbed upon a bug which break the get_field() inside an ACFE Form action when a previous actions save additional meta fields (which is probably your case).

    I’m working on a fix, it should be up today. I’ll keep you updated here.

    Sorry for the inconvenience.

    Regards.

    Thread Starter Kimantis_Creative_Group

    (@kimantis_creative_group)

    Yes, I’m pretty sure it has to be be with previous actions.
    Everything else seems fine.

    I was unable to get debug.log to work.. might be security on my side. Will have to investigate a little bit more.

    But fields are empty when sending but default php functions works. I never had any issues until the last patch 😉

    Thank you for working so hard.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Just a heads up to let you know that the latest ACF Extended 0.8.8.1 patch fixed that issue. Please check your form, everything should be fine now.

    My post about hook arguments is still relevant tho, check your code just in case.

    Sorry for the inconvenience.

    Have a nice day!

    Regards.

    Thread Starter Kimantis_Creative_Group

    (@kimantis_creative_group)

    That fixed it 🙂 Thank you so much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Emails are empty since the new update’ is closed to new replies.