Mailchimp drush script #3925

Here's a script for fetching email addresses and metadata.  Results are csv:
username, first name, last name, installation, purl (modifier, unless domain present)
Only get fn/ln from users.  Concatenate domains.  #3925

Didn't realize the name fields were attached to profiles as well.  uid 178 was also getting names from node 178 when that node was a person.

Domains are space separated and added to end of line.  This probably could have been part of the original query but I didn't see the point in a one off script.
Collected info for mailchimp updates #3925

I'm still not sure what mechanism should update users, but I was able to set up a function for collecting their info.

Next: function for getting a user's info from mailchimp and updating it.  That means adding a name, sites, and the servers they're active on, without erasing what's already there.
Mailchimp updates users #3925

Mailchimp used to only subscribe users during account creation (and via the box, but htat's irrelevant).  Now it updates accounts progressively.

* hook_user_delete
  Deleted users should have their emails removed as a courtesy.
* hook_node_insert, hook_node_update
  We're storing a user's site membership in a mailchimp field.  When they gain a vsite, either by it being created for them or its owner changed to them, update mailchimp.

Two new pieces of data are stored in special merge vars on mailchimp list (and they're detailed in the readme).
* sites list.  This is a csv list of the sites owned by the user.
* instances list.  This is a csv list of the OS installations on which the user has an account.

Creating the sites list required a hacky static var.  During the site/register process, the user is created before the vsite.  When that user was getting its list of sites, that list was empty.  But when the vsite was created and checked if its user had an subscriptions, mailchimp said no!  This was because the user hadn't had a chance to confirm yet.  The easy solution was to store the domain in a static so I'd have access to it when new users get added.

Both sites and instances vars should merge with existing values, instead of overwriting.

While I was in there I also removed some useless code and fixed a bug that prevented last names from being added.  I think both bugs were introduced when we updated the module to d7.
Mailchimp node updates should include the new node... #3925

The updates triggered on node insert and update didn't include the node yet because it wasn't necessarily owned by the user yet.  This fixes that.
Merge pull request #4105 from openscholar/3925-mailchimp

3925 mailchimp