Support » Plugin: Forms: 3rd-Party Integration » Does it work with Caldera Forms?
Does it work with Caldera Forms?
-
Hi guys,
I’ve used your awesome plugin on several occasions with CF7. I now worked with Caldera (smooth logic in there!) and I wondered: will 3rdPSI catch the Caldera submissions?
Thanks for the great work!
-
@anton_th I am the developer of Caldera Forms. Thanks for saying such nice things about us. I can’t answer your original question, but would recommend that you take a look at our Run Action processor: https://calderaforms.com/downloads/caldera-forms-run-action/
Josh, Hi! 🙂 Exactly what I need – many many thanks. I really am impressed by Caldera Forms, it’s a joy to work with. Again, thanks for your suggestion, it’s just what I need!
Hmmm, I’ve been playing with it but I need to do a http POST to an external URL, in key value pairs. I’m sure it can be done, I just don’t have the php skills to figure it out. So: although impressive again, my particular question isn’t solved yet…
It won’t work out of the box with another form plugin, but they generally follow similar pathways and as long as has places to hook it can be integrated. Judging by @shelob9’s (the caldera author) comment it probably has the necessary hooks. You can contact me through my site for custom integrations, or I could point you in the direction of how you’d integrate the two.
I think the first example on the following link is what you want, posting data directly from a Caldera submission to something else:
https://calderaforms.com/doc/getting-submission-data-in-a-form-processor//** * Register processor */ add_filter( 'caldera_forms_get_form_processors', function( $processors ) { $processors['my_processor_send_to_api'] = array( 'name' => 'Remote API', 'description' => 'Send Caldera Forms Data To Remove API', 'pre_processor' => 'my_processor_send_to_api_pre_process' ); return $processors; } ); /** * Process submission * * @param array $config Processor config * @param array $form Form config * @param string $process_id Unique process ID for this submission * * @return void|array */ function my_processor_send_to_api_pre_process( $config, $form, $process_id ){ //get all form data $data = Caldera_Forms::get_submission_data( $form ); $response = wp_remote_post( 'https://service.com/api/something', array( 'body' => $data )); //If API responds with success return void if( 200 == wp_remote_retrieve_response_code( $response ) || 201 == wp_remote_retrieve_response_code( $response ) ){ return; } //find and return error if( is_wp_error( $response ) ){ $error = $response->get_error_message(); }elseif ( isset( $response[ 'error' ]) ){ $error = $response[ 'error' ]; }else{ $error = 'Something bad happened'; } //returning in pre-precess stops submission processing. return array( 'note' => $error, 'type' => 'error' ); }
Awesome Jeremy!
It’s what I was looking for, except that I need the Keys to be populated with Slug instead of ID.
I inserted this snippet, but I think the foreach loop skips elements, like the dropdowns. Another loop needed? Other selectors in the foreach loop…? Here’s the snippet.
//added 'raw_' in this line $raw_data = Caldera_Forms::get_submission_data( $form ); foreach( $raw_data as $field_id => $field_value ){ // dont add buttons or html fields to data array as they are not capture values if( in_array( $form[ 'fields' ][ $field_id ][ 'type' ], array( 'button', 'html' ) ) ) continue; // get the field slug for the key instead $data[ $form[ 'fields' ][ $field_id ][ 'slug' ] ] = $field_value; } $response = wp_remote_post( 'https://www.lxxxxxxxxxxx/xxxxxx.asp', array( 'body' => $data ));
(I tried disabling the ‘skip buttons and html’ part, makes no difference).
Any help is greatly appreciated!-
This reply was modified 6 years, 6 months ago by
Anton_Th.
At this point you’re better off posting in the Caldera forum, as this no longer deals with my plugin.
My suggestion is (if you have a test site or can do this live without affecting users) start dumping
$raw_data
and$forms
etc to see what you have to work with —print_r
+exit
(to see it in-page) orerror_log
(if you’ve enabled _WP_DEBUG_).Thanks – but your plugin could do things that Caldera doesn’t! Caldera POSTs the fixed field system IDs (fld_375893723, fld_3894574 etc.) instead of the field Names (email, telnr) together with the Values. Your plugin would come in very handy to map these IDs to names that a receiving app prefers to work with. It already does this with CF and Ninja and what not! The $data and $form format etc. syntax is all fine as is. It’s just that the Key/Value pairs should be Name/Value, or Slug/Value as it’s called in Caldera, instead of SystemID/Value pairs. These Names could even be entered manually in your interface if you can’t provide a “Use ID or Slug” toggle.
I can appreciate that you’re not really interested in this addition to your plugin, it must be a lot of work. I just figured earlier maybe it would be a minor effort with big effect for you: now also supporting Caldera forms. Again: thanks for your time; I’ll head over to Caldera…
-
This reply was modified 6 years, 6 months ago by
Anton_Th.
It’s not that I’m not interested, it’s just that I can’t commit my free time to it at the moment. And it might still be a minor thing to add it, but there’s a lot of overhead around maintaining a plugin, and I don’t want to give you a poor quality of service if I’m not able to devote enough time to help you specifically.
I’ve made it an issue as a reminder or if anyone else wants to contribute in the meantime (https://github.com/zaus/forms-3rdparty-integration/issues/85).
And it’s only because we were talking about a Caldera-specific hook that I suggested continuing your questions in that forum, as I didn’t want to give uninformed advice.
I totally understand!
Sorry if I made the impression of accusing you or anything – I just really think it will add value to your plugin.Don’t know if Caldera is interested in my request though. For them it really must be three lines of code max. I just don’t get that it doesn’t work like that out of the box. Who TF wants to work with fixed internal system variables!?! As long as you keep it within the plugin, it’s fine but transferring will be a nightmare… I’ll keep reminding them every now and then. Thanks for your help!
-
This reply was modified 6 years, 6 months ago by
- The topic ‘Does it work with Caldera Forms?’ is closed to new replies.