function mailchimp_lists_get_subscribers in Mailchimp 7.3
Same name and namespace in other branches
- 8 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_get_subscribers()
- 7.5 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_get_subscribers()
- 7.4 modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_get_subscribers()
- 2.x modules/mailchimp_lists/mailchimp_lists.module \mailchimp_lists_get_subscribers()
Batch processor for pulling in subscriber information for a list.
1 string reference to 'mailchimp_lists_get_subscribers'
- mailchimp_lists_update_member_merge_values in modules/
mailchimp_lists/ mailchimp_lists.module - Triggers an update of all merge field values for appropriate entities.
File
- modules/
mailchimp_lists/ mailchimp_lists.module, line 404
Code
function mailchimp_lists_get_subscribers($field, &$context) {
if (!isset($context['sandbox']['progress'])) {
$context['results']['subscribers'] = array();
$context['sandbox']['progress'] = 0;
}
$limit = 100;
$options = array(
'start' => $context['sandbox']['progress'] / $limit,
'limit' => $limit,
);
$matches = mailchimp_get_members($field['settings']['mc_list_id'], 'subscribed', $options);
if ($matches) {
if (!isset($context['sandbox']['max'])) {
$context['sandbox']['max'] = $matches['total'];
}
foreach ($matches['data'] as $result) {
$context['results']['subscribers'][strtolower($result['email'])] = $result;
$context['sandbox']['progress']++;
}
$context['message'] = t('Check subscription status for contact %count of %total.', array(
'%count' => $context['sandbox']['progress'],
'%total' => $context['sandbox']['max'],
));
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
}