-
AuthorPosts
-
October 3, 2018 at 10:23 am #1017432
Hello,
I’m using the avf_form_send filter to send form datas to an API.
It works well on my main form, but the same function returns a fatal error for 2 others forms (which are translated versions, using Polylang)Here is the PHP error log :
[02-Oct-2018 14:31:07 UTC] PHP Fatal error: Uncaught Error: Call to undefined function () in /home/.../public_html/wp-content/themes/enfold-child/functions.php:160 Stack trace: #0 /home/.../public_html/wp-includes/class-wp-hook.php(300): avia_process_form_data(true, Array, Array) #1 /home/.../public_html/wp-includes/plugin.php(203): WP_Hook->apply_filters(true, Array) #2 /home/.../public_html/wp-content/themes/enfold/framework/php/class-form-generator.php(799): apply_filters('avf_form_send', true, Array, Array, Object(avia_form)) #3 /home/.../public_html/wp-content/themes/enfold/framework/php/class-form-generator.php(261): avia_form->send(Object(avia_form)) #4 /home/.../public_html/wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/contact.php(396): avia_form->display_form(true) #5 /home/.../public_html/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/shortcode-template.class.php(257): avia_sc_contact->shortcode_handler(Array, '\n[av_contact_fi...', 'av_contact', Array) #6 /home in /home/.../public_html/wp-content/themes/enfold-child/functions.php on line 160
Here the PHP code involved:
add_filter('avf_form_send', 'avia_process_form_data', 10, 3); function avia_process_form_data($send, $new_post, $form_params) { global $wp_query; $post_id = intval( $wp_query->get_queried_object_id() ); if ( ($post_id == 5884) || ($post_id == 6936) || ($post_id == 6939) ) { // API stuff } return true; // true in order to Enfold to send the mail }
I’ve checked several time, and the code related to the API works well, the form fields are the same, etc…
The error seems to happen at the line: if ( ($post_id == 5884) || ($post_id == 6936) || ($post_id == 6939) )The only difference I see is that my translated versions are on different subdomains (ie main site on http://www.mysite.com, english on en.mysite.com).
Can you help me fix this issue?
Thanks!
October 4, 2018 at 9:00 pm #1018005Hey Nicolas,
Thank you for using Enfold.
What happens when you remove the intval function? The “get_queried_object_id” function returns an integer by default.
Best regards,
IsmaelOctober 5, 2018 at 11:36 am #1018254Hi Ismael,
Thanks for your reply.
I’ve removed the intval() and it the error is still here : it works on the main site, not the english one (URL in private)
The error log is the same too.I’m out of ideas :(
Thanks for your helpOctober 8, 2018 at 1:21 am #1018739Hi,
Can we access the site? We would like to check the API code.
You may need to upgrade the theme from 4.0.5 to version 4.4.1.Best regards,
IsmaelOctober 8, 2018 at 11:02 am #1018917Hi,
Sure, which email address for the login?
Do you think I need to upgrade the theme first?October 8, 2018 at 10:31 pm #1019262Hi,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
- Install and activate ” Temporary Login Without Password “.
- Go to ” Users > Temporary Logins ” on the left-side menu.
- Click ” Create New “.
- Add the email address for the account ( you can use (Email address hidden if logged out) ), as well as the ” Role ” making that the highest possible and the expiry about four days
( do be sure that we have enough time to debug ). - Click ” Submit “.
- You’ll now have a temporary account. Please provide us here in the private section the URL, so we can login and help you out.
When your issue is fixed, you can always remove the plugin!
If you prefer to not use the plugin, you can manually create a admin user and post the login credentials in the “private data” field.Best regards,
BasilisOctober 9, 2018 at 9:56 am #1019403This reply has been marked as private.October 11, 2018 at 3:13 am #1020118Hi,
I can’t reproduce the issue on the EN version of the form. It is sending the mail properly. (see private field)
Best regards,
IsmaelOctober 29, 2018 at 3:12 pm #1027587Hi Samel,
Here’s some update:
After updating Enfold, WP and the others plugins, we still had the issue.
I honestly don’t know how you got through (the only one in weeks!)Since the logs indicate on this line, we solved the issue by changing :
if ( ($post_id == 5884) || ($post_id == 6936) || ($post_id == 6939) )
by
if ($post_id == 5884) { ... } elseif($post_id == 6936) elseif ... {...}
And it works fine now, go figure :-/
October 30, 2018 at 6:00 am #1027864 -
AuthorPosts
- You must be logged in to reply to this topic.