• Resolved ravensays

    (@ravensays)


    Per 0.8 upgrade: Module: Dynamic Forms – Added action(‘acfe/form/submit/name=form_name’, $form, $post_id) to add custom action on submission

    On admin forms tab ‘Integration’ it shows example using same format BUT on admin forms tab ‘Actions’ for Custom Action it shows ‘Action name*’ . The trigger shown has – action(‘acfe/form/submit/action/action_name’, $form, $post_id).

    I am easily confused LOL so can you please explain somewhere in your documentation or here.

    action(‘acfe/form/submit/name=form_name’, $form, $post_id)
    versus
    action(‘acfe/form/submit/action/action_name’, $form, $post_id)

    So iff we add a custom action on admin tab ‘b_confused’ then all we need do is define it in functions.php with action(‘acfe/form/submit/action/b_confused’, $form, $post_id) function? I

    And the other php example is for something else?

    Thank you and BIG thank you for adding the Forms component to ace-extended. We are a small non-profit and the leap $ to Pro was too big. This was a big help for us.

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

    (@hwk-fr)

    Hello Ravendays,

    I’m glad to hear that my plugin help your organization ??

    I’m currently writing documentation on the website in order to explain all features. Meanwhile, here are some explanations:

    In ACF Extended Dynamic Forms, you have multiple levels of control for your form. Let’s say you have the following configuration:

    Form name: my_form
    Actions:
    – Email
    – Custom action: my_action
    – Create post

    The actions are triggered following the order you’ve set in the form administration. In this example the custom action my_action will be triggered at the second position. If you want to execute an action here, you will have to use:

    
    add_action('acfe/form/submit/action/my_action', 'my_action', 10, 2);
    function my_action($form, $post_id){
        
        // get_field('my_text_field');
        // Do something in my_action
        
    }
    

    This action will be executed after the Email action, and before the Create post. Now, let’s say you have 2 forms, and in both forms you have the same custom action called my_action. If you want to target my_action in a specific form, you can use the following hook:

    add_action('acfe/form/submit/action/my_action/name=my_form', 'my_action', 10, 2); (note the /name=my_form at the end).

    Dynamic Forms are packaged with working actions: Email, Post, Term & User. Those actions also have action name:

    Email – action name: email
    Post – action name: post
    Term – action name: term
    User – action name: user

    Those action names are reserved, because they are used by the native form actions. That’s why you can’t use them as “Custom action name”.

    Let’s say you want to trigger an action after sending an email in the form my_form, you can use the following hook:

    
    add_action('acfe/form/submit/action/email/name=my_form', 'my_email_action', 10, 2);
    function my_email_action($form, $post_id){
        
        // Do something after sending an email in my_form
        
    }
    

    Now let’s say you want to do something at the end of your form submission, and you don’t want to target a specific action, you can use the following hook:

    
    add_action('acfe/form/submit/name=my_form', 'my_form_action', 10, 2);
    function my_form_action($form, $post_id){
        
        // Do something after form submission & after all actions
        
    }
    

    Hope it’s clear ??

    Have a nice day!

    Regards.

    Thread Starter ravensays

    (@ravensays)

    We THANK You for a timely and complete explanation – example. Part of what we do is education via videos. We will be making one that includes using this plugin and referencing it in written portion/ credits.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Action Class on Admin Form Tab?’ is closed to new replies.