This topic contains 0 replies, has 1 voice. Last updated by Sacha Greif 4 years, 6 months ago.
|Posted: Wednesday Jun 27th, 2012 at 12:00 am #17615|
I just spent a day working on integrating my S2Member site with MailChimp, and I wanted to share what I did in hope it helps others.
What I needed was a way to let members know when I added new content (in this case, videos) on the site, with a daily email digest summarizing all the new content posted in the last day. I tried plugins like Subscribe2, but they’re clunky and inflexible. What’s more, they sent the same notification to everybody regardless of subscription level. Thankfully MailChimp is much more powerful and can help us do all of that. Here’s what I did:
1. First I used the S2Member List API to automatically subscribe new members to a MailChimp list, in three different groups according to their membership level (that being said, there are a lot of other plugins to subscribe WP users to MailChimp lists).
2. I then created three RSS Campaigns in MailChimp. Those campaigns subscribe to a RSS feed and auto-send a daily, weekly, or monthly email digest whenever it detects new content. You get a couple template tags that are replaced by the dynamically generated RSS content, otherwise you can use any MailChimp template (or create your own).
3. I know needed the three appropriate RSS feeds. The RSS feed for the highest access level was easy, since these members have access to the whole site. So I simply used WordPress’ built-in custom post type feeds, like this:
The problem was for the other two levels. Level 1 member have access to free videos, plus level 1 videos. While Level 2 members have access to free, Level 1, and Level 2 videos. So I needed to build custom feeds.
I tried many solutions to merge the feeds, including Yahoo Pipes (http://pipes.yahoo.com), but in the end decided to combine the feeds from within WordPress instead. Here’s what that code looks like:
And I can now access my custom feeds at
4. As a bonus, I also used a custom function based on this plugin to extract the video thumbnail for each post and add it to the RSS feed as an RSS enclosure.
So now I have automatic email digests that go out daily only to the appropriate members, include images and a nice template, and have stats on top of that thanks to MailChimp!
That’s it, hope this helps somebody :)