Problem:
Tell us what you are trying to do?
ensure a user_email field from a register form is saved as lowercase
Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data
Is there a similar example that we can see?
trying this:
add_action('cred_before_save_data', 'my_before_save_data_action',10,1); function my_before_save_data_action($form_data) { // if a specific form // 61544 = register form v2 if ($form_data['id']== 61544) { if (isset($_POST['user_email'])) { $lowercaseemail = strtolower($_POST['user_email']); $_POST['user_email'] = $lowercaseemail; } } }
Solution:
The approach you took is correct, I believe the issue might be with the missing 'wpcf' prefix in the field selection.
Can you please try the following code to see if it achieves what you need?
add_action("cred_before_save_data", "my_before_save_data_action", 10, 1); function my_before_save_data_action($form_data) { // if a specific form // 61544 = register form v2 if ($form_data["id"] == 61544) { if (isset($_POST["user_email"])) { $lowercaseemail = strtolower($_POST["user_email"]); $_POST["wpcf-user_email"] = $lowercaseemail; } } }
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 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Sao_Paulo (GMT-03:00)
This topic contains 1 reply, has 2 voices.
Last updated by 11 months, 1 week ago.
Assisted by: Mateus Getulio.