Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-06T21:33:17-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=10045 2011-06-06T21:33:17-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10045&p=20294#p20294 <![CDATA[Re: MailChimp API Integration Failure - Missing datacenter I]]>
Thanks for the super-fast response and update! I wish all developers were as quick as you!

I'll have to look more in detail into my MailChimp issue. The weird thing is that S2Member's logs show everything going smoothly, but I do not see any API activity at MailChimp's site under Account ---> API Keys and Info.

I wonder if the issue could be related to using the new list "group" feature? I have verified that my list ID, group title and group name are all correct. I do wonder if there is an issue with how I configured the group, though. When I created the group title in MailChimp, their site provides an option form how the group signups should appear. I chose the radio button setup, where a user could only select one group. This is because my groups map 1:1 with my WP member levels.

I will try upgrading to the latest version of S2Member to see if that resolves the issue.

Statistics: Posted by wiseeyesmedia — June 6th, 2011, 9:33 pm


]]>
2011-06-06T17:03:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10045&p=20261#p20261 <![CDATA[Re: MailChimp API Integration Failure - Missing datacenter I]]> FYI: s2Member uses an API wrapper, provided by MailChimp, as seen here:
http://apidocs.mailchimp.com/downloads/#php ( we use the PHP wrapper )
/includes/xtnls/mailchimp/nc-mcapi.inc.php

Statistics: Posted by Jason Caldwell — June 6th, 2011, 5:03 pm


]]>
2011-06-06T16:58:39-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10045&p=20260#p20260 <![CDATA[Re: MailChimp API Integration Failure - Missing datacenter I]]> Thanks for reporting this important issue.
~ and thanks for the heads up Cristián.

Not to worry. What you're seeing in the log files, is a represenatation of the MCAPI object instance, and the "host" property respresents the base API host, before it is prefixed by the callServer() method, as shown below.
Code:
    function callServer($method, $params) {
        $dc = "us1";
        if (strstr($this->api_key,"-")){
            list($key, $dc) = explode("-",$this->api_key,2);
            if (!$dc) $dc = "us1";
        }
        $host = $dc.".".$this->apiUrl["host"];
        $params["apikey"] = $this->api_key; 
* So the proper prefixing does occur, it's just not reflected this way in the logs.
@TODO: I'll see what we can do about this.
Done, starting with s2Member v110606+, a "prefix" will be recorded in the logs.



As for the SSL communication. I'll see if we can add a Filter for this. Until then, you can enable SSL communication with MailChimp by modifying this file, if you like:
/includes/classes/list-servers.inc.php, at line #91

Change this:
Code:
$mcapi = new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"]); 

To this:
Code:
$mcapi = new NC_MCAPI ($GLOBALS["WS_PLUGIN__"]["s2member"]["o"]["mailchimp_api_key"], true); 

@TODO: Agreed. Make SSL the default, and provide a Filter to turn it off.
Done. This will be included in the next release of s2Member v110606+.

Statistics: Posted by Jason Caldwell — June 6th, 2011, 4:58 pm


]]>
2011-06-06T03:57:40-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10045&p=20192#p20192 <![CDATA[Re: MailChimp API Integration Failure - Missing datacenter I]]>

Statistics: Posted by Cristián Lávaque — June 6th, 2011, 3:57 am


]]>
2011-06-05T19:35:38-05:00 http://www.primothemes.com/forums/viewtopic.php?t=10045&p=20111#p20111 <![CDATA[MailChimp API Integration Failure - Missing datacenter ID?]]>
Specifically, s2member does not seems to properly decode the specific data center (dc as the MailChimp API calls it) associated with the MailChimp API Key. The specific host s2member should access when using MailChimp's API is dependent upon the data center associated with the account.

For example, API keys are in the format xxxxxxxxxxxxxxx-[dc_id] where dc_id could be "us1" or "us2" or "uk1" or "uk2".

Based on the data center of the API key, s2member needs to submit its API request to different hosts. For example, my data center in my API key is "us2", so my API requests need to go to:

http://us2.api.mailchimp.com/1.3/

According to s2member's MailChimp logs, all my requests are going to the host of "api.mailchimp.com". The logs show an API call as successful, but members are not actually added to my list due to the incorrect (or missing) data center.

See MailChimp API docs:
http://apidocs.mailchimp.com/rtfm/

See s2Member's MailChimp API Logs:

...
'api_email_type' => 'html',
'api_double_optin' => true,
'api_update_existing' => false,
'api_replace_interests' => true,
'api_send_welcome' => false,
'api_response' => 'OK',
'api_success' => true,
'api_properties' =>
NC_MCAPI::__set_state(array(
'version' => '1.3',
'errorMessage' => '',
'errorCode' => '',
'apiUrl' =>
array (
'scheme' => 'http',
'host' => 'api.mailchimp.com',
'path' => '/1.3/',
'query' => 'output=php',
),
'timeout' => 300,
'chunkSize' => 8192,
'api_key' => 'XXXXXXXXXXXXXXXXXXXXXX-us2',
'secure' => false,
)),


I would also suggest s2Member use SSL for the MailChimp API, where possible.

Statistics: Posted by wiseeyesmedia — June 5th, 2011, 7:35 pm


]]>