Forum

Thread tagged as: Problem, Addons, MailChimp

MailChimp v3 long sync time?

I've just installed the new version of the MailChimp app (removed old database tables and files then uploaded new). I'm finding it taking a strange amount of time to sync - the only warning i'm getting is under the Campaigns page (Campaigns are still updating) but it's been like this for nearly an hour. Is that normal? All other tabs are showing nothing.

Tried a new API key in case of conflict with previous stream. There are 775 subscribers and 6 campaigns in the MailChimp account.

Any ideas for how to nudge it along?

Many thanks CH

Perch: 2.8.29, PHP: 5.5.31, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 15d5c781cfcad91193dceae1d2cdd127674ddb3e $, with PDO
Server OS: FreeBSD, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_blog (5.0), perch_forms (1.8.3), perch_comments (1.2), perch_mailchimp (3.0)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_comments', 'perch_mailchimp' );
PERCH_LOGINPATH: /modify
PERCH_PATH: /var/www/html/(redacted).com/modify
PERCH_CORE: /var/www/html/(redacted).com/modify/core
PERCH_RESFILEPATH: /var/www/html/(redacted).com/modify/resources
Image manipulation: GD
PHP limits: Max upload 24M, Max POST 8M, Memory: 128M, Total max file upload: 8M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: (redacted).com
DOCUMENT_ROOT: /var/www/html(redacted).com
REQUEST_URI: /modify/core/settings/diagnostics/
SCRIPT_NAME: /modify/core/settings/diagnostics/index.php
Chris Henry

Chris Henry 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

How frequently is your task scheduler running?

We pull down 100 records at a time, each time it runs. A quicker way would be to sit and refresh the page, but that's obviously a bit tedious.

Hi Drew - I havn't setup the task scheduler yet (was waiting on initial download), but clicked the sync buttons for a while and nothing happens... I'll setup a scheduler for hourly updates to see if that resolves.

thanks CH

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sync won't help - it's already syncing. Just reload the page or click through the pagination. Each time you do, more data is downloaded.

There's been no change since yesterday - all pages are completely blank (i.e. no pagination).

Database tables blank except for 'perch2_mailchimp_imports' which shows 31 records for importType: 'campaigns' and importCount: '20' in each record.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you entered your API key?

Turn on debug and let me know what it outputs at the bottom of the page.

Yes, API key is definitely in settings.

Debug page output:

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='3dff0e22d4e63ebe2b19f2ebc96bc14b' LIMIT 1
UPDATE perch2_users SET userHash='3ce4ba81a794d847465af8466eeff22e' WHERE userID='1'
[44] SELECT p.privKey FROM perch2_user_privileges p
[34] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_mailchimp_lists ORDER BY listTitle ASC LIMIT 0, 20
[0] SELECT FOUND_ROWS() AS `count`
Attempting app installation: perch_mailchimp
[1] SHOW TABLES LIKE "perch2_mailchimp_lists"
Array
(
    [headers] => Array
        (
            [url] => https://us5.api.mailchimp.com/3.0/lists?
            [content_type] => 
            [http_code] => 0
            [header_size] => 0
            [request_size] => 0
            [filetime] => -1
            [ssl_verify_result] => 1
            [redirect_count] => 0
            [total_time] => 0.047027
            [namelookup_time] => 0.030747
            [connect_time] => 0.03221
            [pretransfer_time] => 0
            [size_upload] => 0
            [size_download] => 0
            [speed_download] => 0
            [speed_upload] => 0
            [download_content_length] => -1
            [upload_content_length] => -1
            [starttransfer_time] => 0
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 104.71.208.9
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 193.200.98.xxx(redacted)
            [local_port] => 37090
        )

    [body] => 
)
[nil] SELECT * FROM perch2_mailchimp_lists ORDER BY listTitle ASC
adding: Here are your MailChimp lists.
adding: Sync
Queries: 9
Memory: 2.7731
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like you're getting no response from MailChimp there at all.

Hi Drew

I made sure core was up to date, dropped all the mailchimp tables and reinstalled with a fresh copy of mailchimp 3 app, after that I removed the API key from Settings and entered that again.

Still nothing, except for the first visit to the Lists page which showed Page 1 of 2 and a Next button which I clicked to no effect...

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='35ae8710ec24960ab9bee8242b05a275' LIMIT 1
UPDATE perch2_users SET userHash='fff5eebd4af7bc4a3ee248d8cea7fba9' WHERE userID='1'
[44] SELECT p.privKey FROM perch2_user_privileges p
[34] SELECT * FROM (SELECT DISTINCT settingID, settingValue, userID FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID, settingValue, userID
[1] SELECT * FROM perch2_mailchimp_imports WHERE 1=1 AND importType='campaigns' ORDER BY importUpdated ASC LIMIT 1
Array
(
    [headers] => Array
        (
            [url] => https://us5.api.mailchimp.com/3.0/campaigns?count=20&offset=0
            [content_type] => 
            [http_code] => 0
            [header_size] => 0
            [request_size] => 0
            [filetime] => -1
            [ssl_verify_result] => 1
            [redirect_count] => 0
            [total_time] => 1.649942
            [namelookup_time] => 0.030198
            [connect_time] => 0.031655
            [pretransfer_time] => 0
            [size_upload] => 0
            [size_download] => 0
            [speed_download] => 0
            [speed_upload] => 0
            [download_content_length] => -1
            [upload_content_length] => -1
            [starttransfer_time] => 0
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 104.71.208.9
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 193.200.98.***
            [local_port] => 61218
        )

    [body] => 
)
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_mailchimp_campaigns ORDER BY campaignCreated DESC LIMIT 0, 20
[0] SELECT FOUND_ROWS() AS `count`
INSERT INTO perch2_mailchimp_imports(importType,importSourceID,importCount,importOffset) VALUES('campaigns',NULL,20,0)
[1] SELECT * FROM perch2_mailchimp_imports WHERE importID='4' LIMIT 1
No ids to log.
Array
(
    [headers] => Array
        (
            [url] => https://us5.api.mailchimp.com/3.0/campaigns?count=20&offset=0
            [content_type] => 
            [http_code] => 0
            [header_size] => 0
            [request_size] => 0
            [filetime] => -1
            [ssl_verify_result] => 1
            [redirect_count] => 0
            [total_time] => 0.013932
            [namelookup_time] => 2.0E-5
            [connect_time] => 0.00142
            [pretransfer_time] => 0
            [size_upload] => 0
            [size_download] => 0
            [speed_download] => 0
            [speed_upload] => 0
            [download_content_length] => -1
            [upload_content_length] => -1
            [starttransfer_time] => 0
            [redirect_time] => 0
            [redirect_url] => 
            [primary_ip] => 104.71.208.9
            [certinfo] => Array
                (
                )

            [primary_port] => 443
            [local_ip] => 193.200.98.***
            [local_port] => 15829
        )

    [body] => 
)
[nil] SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_mailchimp_campaigns ORDER BY campaignCreated DESC LIMIT 0, 20
[0] SELECT FOUND_ROWS() AS `count`
adding: List campaigns
adding: Sync
Queries: 12
Memory: 2.9143
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you see anything in your MailChimp account if you go to the bottom of the API Keys page?

Sadly no. "Goose egg. There's no information available."

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think the requests are making it out from your server. Do you have any sort of error log?

Yes of course, here's a sample of what I'm getting:

[Mon May 02 12:47:03 2016]  PHP Warning 2.27.60.32  PHP Warning: Invalid argument supplied for foreach() in /var/www/html/***/modify/addons/apps/perch_mailchimp/modes/subscribers.pre.php on line 36, referer: https://www.***/modify/addons/apps/perch_mailchimp/campaigns/
[Mon May 02 12:41:29 2016]  PHP Warning 2.27.60.32  PHP Warning: Invalid argument supplied for foreach() in /var/www/html/***/modify/addons/apps/perch_mailchimp/modes/webhooks.pre.php on line 33, referer: https://www.***/modify/addons/apps/perch_mailchimp/campaigns/
[Mon May 02 12:41:26 2016]  PHP Warning 2.27.60.32  PHP Warning: Invalid argument supplied for foreach() in /var/www/html/***/modify/addons/apps/perch_mailchimp/modes/subscribers.pre.php on line 36, referer: https://www.***/modify/addons/apps/perch_mailchimp/
[Mon May 02 12:40:34 2016]  PHP Warning 2.27.60.32  PHP Warning: Invalid argument supplied for foreach() in /var/www/html/***/modify/addons/apps/perch_mailchimp/modes/webhooks.pre.php on line 33, referer: https://www.***/modify/addons/apps/perch_mailchimp/campaigns/
[Mon May 02 12:40:29 2016]  PHP Warning 2.27.60.32  PHP Warning: Invalid argument supplied for foreach() in /var/www/html/***/modify/addons/apps/perch_mailchimp/modes/subscribers.pre.php on line 36, referer: https://www.***/modify/addons/apps/perch_mailchimp/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include_once(): Failed opening '/var/www/html/***/modify/addons/apps/perch_mailchimp/events.php' for inclusion (include_path='.:/usr/local/share/pear') in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 28, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include_once(/var/www/html/***/modify/addons/apps/perch_mailchimp/events.php): failed to open stream: No such file or directory in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 28, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include_once(): Failed opening '/var/www/html/***/modify/addons/apps/perch_mailchimp/fieldtypes.php' for inclusion (include_path='.:/usr/local/share/pear') in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 25, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include_once(/var/www/html/***/modify/addons/apps/perch_mailchimp/fieldtypes.php): failed to open stream: No such file or directory in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 25, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include(): Failed opening '/var/www/html/***/modify/addons/apps/perch_mailchimp/lib/vendor/autoload.php' for inclusion (include_path='.:/usr/local/share/pear') in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 14, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:32 2016]  PHP Warning 2.27.60.32  PHP Warning: include(/var/www/html/***/modify/addons/apps/perch_mailchimp/lib/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/***/modify/addons/apps/perch_mailchimp/admin.php on line 14, referer: https://www.***/modify/core/settings/diagnostics/
[Mon May 02 12:38:23 2016]  PHP Fatal   66.249.69.145   PHP Fatal error: Call to undefined function perch_mailchimp_form() in /var/www/html/***/modify/templates/layouts/global.footer.php on line 43
[Mon May 02 12:33:30 2016]  PHP Fatal   86.152.24.240   PHP Fatal error: Call to undefined function perch_mailchimp_form() in /var/www/html/***/modify/templates/layouts/global.footer.php on line 43, referer: https://www.google.co.uk/
[Mon May 02 12:32:19 2016]  PHP Fatal   68.180.229.123  PHP Fatal error: Call to undefined function perch_mailchimp_form() in /var/www/html/***/modify/templates/layouts/global.footer.php on line 43
[Mon May 02 12:31:44 2016]  PHP Fatal   5.255.253.80    PHP Fatal error: Call to undefined function perch_mailchimp_form() in /var/www/html/***/modify/templates/layouts/global.footer.php on line 43

...of course the subscribe form in the footer isn't working as a result. What's more I have an option to opt-in to newsletter subscription for 4 other booking forms on the website which are likely not being processed either.

Drew McLellan

Drew McLellan 2638 points
Perch Support

It's strange that perch_mailchimp_form() isn't defined - are you sure everything's uploaded?

Does it work locally?

Everything was working perfectly until I dropped the old tables and installed the new mailchimp. I didn't test these locally but everything worked on the live test.

I re-uploaded everything yesterday so I can't imagine anything is missing.

However, I just realised the templates are split into folders now e.g. (subscribers folder with subscribers.html inside).

My footer code is as follows:

<?php perch_mailchimp_form('subscribe.html'); ?>

and that file still exists inside the /templates/mailchimp folder (my user created folder, not the default app templates one)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you updated the template?

I've now updated the template path to forms/subscribe.html, removed the old ones in the template folder and updated the template to include hidden list id in that location. Also noticed in admin that only the Campaigns page for example shows the 'Campaigns are still updating' message, which the others do not.

The form submit but nothing is sent to MailChimp.

I also uploaded the new app files again.

Template code:

<h3>Subscribe to our newsletter</h3>
<perch:form id="subscribe" class="subscribe-form group" role="form" app="perch_mailchimp" double-optin="false" send-welcome="false" action="/#contact">
  <div class="row">
    <div class="col-lg-11 col-md-11 form-group">
      <perch:label class="sr-only" for="email-footer">Email</perch:label>
      <perch:input id="email-footer" class="form-control" required="true" type="email" mailer="email" placeholder="Email address" />
      <perch:error type="required" for="email-footer">Required</perch:error>
      <perch:input id="btnsubmit-footer" type="submit" class="btn btn-primary" value="Subscribe" />
      <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
      <perch:input type="hidden" id="list" value="4d3dc00189" mailer="list" />
    </div>
  </div>

    <perch:success>
        <p>Thank you for subscribing!</p>
    </perch:success>

</perch:form>

Any further suggestions? I'd consider rolling back as v2 seemed to be working ok but would obviously prefer the new API in use.

Thanks for your perseverance.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you still getting the error about the function not existing?

No, I've just reloaded and tried submitting via the template above and got no errors - so that 'appears' to be fixed.