I Have about 700 accounts on my site already.
I just added MailChimp to my site.
How do I go about subscribing all of the old users to this new install?

Comments

barry769’s picture

Status: Active » Closed (fixed)
Technikal’s picture

subscribing to this one

tpainton’s picture

Really? No Answer.. I find that amusing.. Especially since I have been sitting here for 2 hours waiting for my list to populate on mailchimp after running cron 2 dozen times.. This is a legitimate question.

andrewbenkard’s picture

sub

jasonconnery’s picture

If I'm understanding correctly:

You need to create a list on Mailchimp's site. Then go to the MailChimp configuration tab (In Drupal) and click the tab Lists & Users and then click "Add new list". In that form you can select the mail list you just created (at MailChimp site) and also indicate the type of list: Required, Optional, Free form. You want to select Required. Required lists are automatically syncronized with the sites users.

jeffschuler’s picture

Yes, to import all users, set the list to Required and run cron a bunch of times.

I needed to import a subset of users. I wrote a script to do so, (needs Drupal bootstrapped -- run with drush php-script):

<?php

/*
 * Return uid=>email for all of the users we want to subscribe
 */
function users_to_subscribe() {
  $uids_query = 'SELECT uid, mail FROM {users} WHERE status=1'; // Change query to choose your users
  $uids_result = db_query($uids_query);
  $users = array();
  while ($uid_row = db_fetch_array($uids_result)) {
    $users[$uid_row['uid']] = $uid_row['mail'];
  }
  return $users;
}

$all_lists = variable_get('mailchimp_lists', array());
$list = reset($all_lists); // Just using the first list here

$q = _mailchimp_get_api_object();

$users = users_to_subscribe();
foreach ($users as $uid => $email) {
  $merge_vars = _mailchimp_load_user_list_mergevars($uid, $list->id, $q->listMergeVars($list->id));
  foreach ($merge_vars as $var) {
    print "$var\t";
  }
  $ret = _mailchimp_subscribe_user($list, $email, $merge_vars, FALSE);
  if ($ret == 1) {
    print "SUCCESS\n";
  } else {
    print "FAILED ($ret)\n";
  }
}

?>
zuernbernhard’s picture

This does not work any more in the current mailchimp module for D7

OregonTown’s picture

Issue summary: View changes

yes Zuern how do you do this now in the new updated mailchimp module?

Can you set a list to required? How do I import all users?

camdore’s picture

I'm having the same issue how do you do this for D7?