Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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!

    #1018005

    Hey 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,
    Ismael

    #1018254

    Hi 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 help

    #1018739

    Hi,

    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,
    Ismael

    #1018917

    Hi,

    Sure, which email address for the login?
    Do you think I need to upgrade the theme first?

    #1019262

    Hi,

    Please post us your login credentials (in the “private data” field), so we can take a look at your backend.

    1. Install and activate ” Temporary Login Without Password “.
    2. Go to ” Users > Temporary Logins ” on the left-side menu.
    3. Click ” Create New “.
    4. 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 ).
    5. Click ” Submit “.
    6. 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,
    Basilis

    #1019403
    This reply has been marked as private.
    #1020118

    Hi,

    I can’t reproduce the issue on the EN version of the form. It is sending the mail properly. (see private field)

    Best regards,
    Ismael

    #1027587

    Hi 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 :-/

    #1027864

    Hi,

    Great! Not really sure how that modification fixed it but I’m glad it did.
    Have a nice day. :)

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.