简体   繁体   中英

wordpress form plugin that allows to give a custom url in form action

i am searching a wordpress plugin that allow admin to create a form and submit that form to a custom url. I used contact form 7 but it doesn't allow such type of functionality.

The only solution that i found is, either create a custom form or to use contact form 7 hooks to fetch post data and sent that data to a custom url via a curl call.

Any better solution please??

Used this small ninja hook, but not working:

function ninja_forms_handler() {
  add_action ( 'ninja_forms_post_process', 'change_ninja_forms_landing_page', 1, 2 );
}
add_action('init', 'ninja_forms_handler');

function change_ninja_forms_landing_page(){
    global $ninja_forms_processing; 

    $form_id = $ninja_forms_processing->get_form_ID(); 

    $ninja_forms_processing->update_form_setting( 'landing_page', 'test.php' ); 
    }     
}

Through contact form custom action URL 通过联系表单自定义操作网址

  1. Create "custom_url.php" file in your site root folder In this file you can get contact form post data and write your curl code and whatever you want..

  2. Copy the below code and paste in your theme function.php file

      add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url'); function wpcf7_custom_form_action_url() { return 'custom_url.php'; } 
  3. Give this file "custom_url.php" to contact form action. Copy the below code and paste it in your page or post whereever you want.

    <form class="" action="custom_url.php" method="post" name="">
    [contact-form-7 id="1" title="contact form 7"]
    </form>

Though contact form 7 hook "wpcf7_before_send_mail" 尽管联系表7勾有“ wpcf7_before_send_mail”

add_action('wpcf7_before_send_mail', 'CF7_pre_send');

function CF7_pre_send($cf7) {
    $submission = WPCF7_Submission::get_instance();

    if ($submission) {
        $posted_data = $submission->get_posted_data();
        $arrFields = array();
        foreach ($posted_data as $key => $value) {
            //$strKeyVals .= $key.":".$value.", ";
            if ("_wp" != substr($key, 0, 3)) {
                $arrFields[] = $key . '${$' . $value;
            }
        }
/* Here you can write curl and whatever you want */

    }
}

This should do the trick CF7 Docs .

Add the code to the footer of your Contact page template only.

Let me know how you get on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM