• Resolved Ambyomoron

    (@josiah-s-carberry)


    Please let me know with this debug log message means:

    Invalid Resource Page: Checkbox Integrations || Type: Checkbox Integration Subscribe User || Time: 16 May 2018 14:28

    The web server error log has the following message:

    PHP Notice: Trying to get property of non-object in /home/wordpress/wp-content/plugins/duplicate-post/duplicate-post-common.php on line 123, referer: https://mysite.com/wp-admin/admin.php?page=yikes-inc-easy-mailchimp-settings&section=integration-settings

    I disabled the Duplicate post plugin, but the error is still occurring in Easy forms.

    It concerns the Contact 7 integration. It started off by working OK. Then it started to work intermittently. Now it doesn’t work at all.

    I rechecked to Contact 7 integration settings – no issue there.
    I rechecked the Contact 7 form, which correctly displays the Mailchimp checkbox and label.
    Aside from the mailchimp integration part, the Contact 7 form is being handled correctly. No error messages on that end.

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hey Josiah,

    “Invalid Resource” means the API call was unsuccessful. The most common reason that this occurs for our checkbox integrations is that the list your integration is connected to has required fields and the API call is only sending the email. Could this be the case?

    Let me know.

    Cheers,
    Kevin.

    Oh – the duplicate-post thing is not relevant. That plugin is probably looking for and using the global $post variable on pages where it’s not defined (like our checkbox integrations page).

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    No, that’s not the case. I had added the following to functions.php:

    function additional_contact_form_7_data( $merge_variables, $cf7_variables ) {
    
        // Check our $cf7_variables array for 'first-name'
        if ( isset( $cf7_variables['first-name'] ) ) {
    
            // Filter name and add it to our MailChimp merge variables array 
            $merge_variables['FNAME'] = filter_var( $cf7_variables['first-name'], FILTER_SANITIZE_STRING );
            $merge_variables['MMERGE8'] = filter_var( $cf7_variables['first-name'], FILTER_SANITIZE_STRING );
        }
        // Check our $cf7_variables array for 'last-name'
        if ( isset( $cf7_variables['last-name'] ) ) {
    
            // Filter name and add it to our MailChimp merge variables array 
            $merge_variables['LNAME'] = filter_var( $cf7_variables['last-name'], FILTER_SANITIZE_STRING );
        }
        return $merge_variables;
    }
    add_filter( 'yikes-mailchimp-contact-form-7', 'additional_contact_form_7_data', 10, 2 );

    FNAME, LNAME and MMERGE8 are the mandatory fields. But what is bizarre is that it had worked, then it stopped working.

    I was in touch with Mailchimp and they told me that the PUTs were going through — sometimes.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    I don’t know what’s going on. Are the fields that you’re adding via the filter function required by CF7?

    Try adding this filter function. It will add some extra information to your error log. Then test the CF7 form again and show me the error log entry.

    /** Filter Checkbox Integration Request Body **/
    add_filter( 'yikes-mailchimp-checkbox-integration-body', 'yikes_mailchimp_filter_checkbox_request_body', 10, 2 );
    
    function yikes_mailchimp_filter_checkbox_request_body( $request_body, $integration_type ) {
    
    	$request_body_string = print_r( $request_body, true );
    
    	$error_logging = new Yikes_Inc_Easy_Mailchimp_Error_Logging();
    	$error_logging->maybe_write_to_log(
    		$request_body_string,
    		__( "Testing CF7 Integration", 'yikes-inc-easy-mailchimp-extender' ),
    		__( "Testing CF7 Integration", 'yikes-inc-easy-mailchimp-extender' )
    	);
    
    	return $request_body;
    }
    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    With that debugging function, I get this output:

    Array ( [email_address] => [email protected] [merge_fields] => Array ( [email] => [email protected] [FNAME] => Info [MMERGE8] => Info [LNAME] => 112 [COUNTRY] => Afghanistan [MMERGE12] => [MMERGE17] => X ) [status_if_new] => Pending [timestamp_signup] => 1526476874 [ip_signup] => 111.111.111.111 )

    Let me decode. The merge fields FNAME, LNAME and MMERGE8 are mandatory. They all contain the right data, as per what I entered in the form.
    MMERGE12 is not mandatory. The other merge field values are correct. The IP addr has been obfuscated by me.

    The only curious thing I see are the names of the email field. The 2nd time it is labeled as [email]. However, in my Contact 7 form, the template has the following:

    <p>*Your Email: [email* your-email] </p>

    It is as if the field type (email) is being confused with the field name (your-email)

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Did you obfuscate MMERGE12?

    This doesn’t look right: [MMERGE12] => [MMERGE17] => X.

    That should look something like [MMERGE12] => '' [MMERGE17] => X.

    It might be that the print function is stripping out an empty value and that this is correct but I’d like to make sure.

    Also, how are the MMERGE12 and MMERGE17 fields being added? They’re not in the filter function you showed earlier.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    MMERGE12 was blank in this case. It is not mandatory.
    MMERGE17 is just set to ‘X’

    Actually, there are the values sent to Mailchimp that come from the form completed by the user and then there are some hard coded values for certain other merge fields.

    Sorry about the confusion. I have been trying to figure out where the problem is by adding one by one additional fields to be set in MailChimp. But it fails no matter what fields I try to set, whether I put values in the non-mandatory fields or not.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    As this problem is not yet resolved and the integration with Contact 7 is simply not working, I would be delighted if we could advance on the diagnosis. I repeat my remark above about the apparent confusion between the definition of the form in Contact 7 and how Easy Forms for Mailchimp seems to be parsing it:

    “The only curious thing I see are the names of the email field. The 2nd time it is labeled as [email]. However, in my Contact 7 form, the template has the following:

    <p>*Your Email: [email* your-email] </p>

    It is as if the field type (email) is being confused with the field name (your-email)”

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Josiah,

    I don’t know what’s going on.

    1. The COUNTRY merge field… Is that part of a full address field or do you have a standalone text field for Country?

    2. Here is another way to test…

    – Make a form based on the same list you’ve integrated with CF7
    – Add all of the fields that are present on your CF7 list. This includes all of the fields you’re integrating with via filter functions. (e.g. FNAME, LNAME, Country, MMERGE12, MMERGE17)
    – Test this form. Are you able to send the data to MailChimp?
    – Also, send me the URL of this form so I can test it

    Cheers,
    Kevin.

    • This reply was modified 6 years, 6 months ago by yikesitskevin.
    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    1. COUNTRY is a standalone field using a dropdown list
    2. I will test as you suggest
    3. As my site is a test site which I do not want to broadcast about, I have sent you the URL via a tweet.
    4. So, you confirm that seeing [email] rather than [your-email] in the debug log is NOT an issue?

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    1. Unless I’m mistaken, a drop down field can only accept values that have been pre-defined. Can you confirm one of the pre-defined values for Country is Afghanistan?

    4. This is not an issue. CF7 calls it your-email and we rename that to email.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    OK. I have created a form using the Easy Forms plugin containing the same fields as I am attempting to send to mailchimp via a Contact 7 form. It works fine. I conclude from this that the issue is not with the Mailchimp interface. Rather, it concerns specifically the Contact 7 / Easy Forms integration. Note, too, that I successfully use the WooCommerce / Easy Forms integration, using exactly the same fields and filters as what I attempting to do with Contact 7.

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    The country name is not an issue. I’ve got the same list in MailChimp and in the Contact 7 form.

    However, a new development. I have disabled all the plugins that are not essential to the opting in and, lo, now the integration works. I hope to identify which plugin might be in conflict and will update.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Oh! New development! That’s super helpful. I can’t imagine a plugin conflicting with this… Let me know what’s going on!

    Thread Starter Ambyomoron

    (@josiah-s-carberry)

    So I started reactivating my plugins one by one, testing the Contact 7 integration each time. After about 8 plugins reactivated, the interface failed. I thought I might have found the culprit. BUT…when I deactivated that plugin again and retested, the integration still failed.

    Clearing the browser cache had no influence on the behavior. Changing browser had no influence.

    Is it possible that there is a memory leak or some variables not being reinitiated when needed, or some other technical cause for this problem?

    Here is an entry from the debug log where the integration succeeded:

    Array ( [email_address] => [email protected] [merge_fields] => Array ( [email] => [email protected] [FNAME] => Info [MMERGE8] => Info [LNAME] => 125 [COUNTRY] => Afghanistan [MMERGE12] => [MMERGE17] => X ) [status_if_new] => Pending [timestamp_signup] => 1526922001 [ip_signup] => 123.123.123.123 ) 
    
    Page: Checkbox Integrations || Type: Checkbox Integration Subscribe User || Time: 21 May 2018 19:01

    Here is the following entry from the debug log, where the integration failed:

    Invalid Resource 	
    
    Array ( [email_address] => [email protected] [merge_fields] => Array ( [email] => [email protected] [FNAME] => Info [MMERGE8] => Info [LNAME] => 126 [COUNTRY] => Afghanistan [MMERGE12] => [MMERGE17] => X ) [status_if_new] => Pending [timestamp_signup] => 1526922060 [ip_signup] => 123.123.123.123 )
    
    Page: Checkbox Integrations || Type: Checkbox Integration Subscribe User || Time: 21 May 2018 19:05

    The only differences I see are 1) the subscriber email address, which simply cannot be the issue – I change the address for every test; and 2) the time of the test

    • This reply was modified 6 years, 6 months ago by Ambyomoron.
    • This reply was modified 6 years, 6 months ago by Ambyomoron.
    • This reply was modified 6 years, 6 months ago by Ambyomoron.
    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    So now we’re back to the point where it’s working intermittently and failing more often than not. That doesn’t make sense; if the same request body is being sent then the same response should be received.

    You said you were currently working from a test site; is there anything about your site’s infrastructure that would make you believe API calls would fail? Is there a short timeout period?

    If you log into MailChimp.com, do you see anything odd on your API page? ([mailchimp-domain]/account/api/)

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘Invalid resource in Contact 7 integration’ is closed to new replies.