This hook allows you to add trigger actions and add errors after all other errors have been processed.
Usage
add_filter('frm_entries_before_create', 'process_cc', 10, 2);
Parameters
- $errors (array)
- $form (object)
Examples
Send submitted entry to another site
Sometimes there is a need to send your data on the another site without actually redirecting to it. You can use the following code in conjunction with the Formidable API in order to accomplish this. This will require quite a bit of customization to put together the url needed.
add_filter('frm_entries_before_create', 'yourfunctionname', 30, 2); function yourfunctionname( $errors, $form ) { if($form->id == 5){ //replace 5 with the id of the form $args = array(); if(isset($_POST['item_meta'][30])) //replace 30 and 31 with the appropriate field IDs from your form $args['data1'] = $_POST['item_meta'][30]; //change 'data1' to the named parameter to send if(isset($_POST['item_meta'][31])) $args['data2'] = $_POST['item_meta'][31]; //change 'data2' to whatever you need $response = wp_remote_post('http://example.com', array('body' => $args)); $body = wp_remote_retrieve_body( $response ); if ( is_wp_error( $response ) || is_wp_error( $body ) ) { $errors[] = 'There was an error sending your request'; } } return $errors; }
If you would like to add your own example, click here.
Have something to add?
Click here to provide feedback on this page.