Skip Navigation

[Resolved] Problem with FORM after validation when using cred_save_data

This thread is resolved. Here is a description of the problem and solution.

Problem:

Use PHP function curl_exec() in cred_save_data action.

Solution:

You need to disable curl outputs, for example:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

Relevant Documentation:

https://www.php.net/manual/en/function.curl-setopt.php

This support ticket is created 4 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Franck 4 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1574365

Hello,
I use CRED FORM and when i use api to catch POST DATA, the validation message doesn't work.
When i remove API , that works.

Exemple with this FORM : hidden link
The form is here : hidden link

(first link RECEVEZ LE GUIDE)

And i use custom code : hidden link

ZAPIER

Thanks a lot for your answer.

#1575403

Hello,

I can see the problem in your website, here are what I found:
hidden link
Code personnalisé-> Find and edit item "zapier", comment/remove line:

$result = curl_exec($ch);

Test it in front-end:
hidden link

It works fine, it seems to a problem of the custom PHP codes, did you get any PHP debug logs from your website, can you share the debug logs?
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/

#1575661

Hi,
Thanks for your answer.
Yes you're right that works, but if i comments this line my form is not send to my webhook.

I have activated debug mode, i have some errors, but i don't think it is the problem

mmo/wp-includes/functions.php on line 4986

Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.) in /home/impotscocq/expert-invest-immo/wp-includes/functions.php on line 4986

Notice: Constant FORCE_SSL_ADMIN already defined in /home/impotscocq/expert-invest-immo/wp-config.php on line 99

Notice: Undefined index: menu in /home/impotscocq/expert-invest-immo/wp-content/themes/toolset-starter-child/functions.php on line 39

Notice: Undefined index: type-residence in /home/impotscocq/expert-invest-immo/wp-content/themes/toolset-starter-child/functions.php on line 505

Notice: Undefined index: loi in /home/impotscocq/expert-invest-immo/wp-content/themes/toolset-starter-child/functions.php on line 498

Notice: Undefined index: type-residence in /home/impotscocq/expert-invest-immo/wp-content/themes/toolset-starter-child/functions.php on line 505

Notice: Undefined index: type-residence in /home/impotscocq/expert-invest-immo/wp-content/themes/toolset-starter-child/functions.php on line 505

#1576465

The problem is in your custom PHP codes, it outputs the CURL results, and break the Toolset form result, I have edited your custom PHP codes, add line 35:

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

So the PHP curl won't output anything, only return the result in variable $result. Please test again, check if it is fixed. thanks

More help:
hidden link
CURLOPT_RETURNTRANSFER
TRUE to return the transfer as a string of the return value of curl_exec() instead of outputting it directly.

#1580353

My issue is resolved now. Thank you!