latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Pro Forms – Multiple addresses to Mailchimp

Home Forums Community Forum Pro Forms – Multiple addresses to Mailchimp

This topic contains 8 replies, has 3 voices. Last updated by  Cristián Lávaque 4 years, 6 months ago.

Topic Author Topic
Posted: Monday Jun 25th, 2012 at 5:36 am #17356

Hi

My customer has Pro forms for signups and captures additional email addresses for colleagues.
Is there a way of submitting the additional email addresses to the mailchimp list along with the email address of the user who signed up ?

Thanks

List Of Topic Replies

Viewing 8 replies - 1 through 8 (of 8 total)
Author Replies
Author Replies
Posted: Monday Jun 25th, 2012 at 5:21 pm #17416

Hi Steve.

They could be added as MailChimp merge fields, but they won’t be emailed to. Only the email the user is subscribed with to the list gets the emails.

You can create the fields for the extra emails from here: [hilite path]Dashboard -› s2Member® -› General Options -› Registration/Profile Fields[/hilite].

Here’s a hack you can modify to include your new custom profile fields as merge fields when adding hiim to MailChimp: http://www.primothemes.com/forums/viewtopic.php?f=4&t=15676&p=50546#p50546

I hope that helps. :)

Posted: Tuesday Jul 3rd, 2012 at 1:57 am #18127

Cristain,

I’ve searched until my eyes hurt! :-) I’m not very experienced with php, but am pretty determined. I’ve found variations of code, mostly due to updates…but you linked the one above 7 days ago, so I’m assuming it’s current.

I’m hoping you can give me some insite as to why this isn’t working:

I’m attempting to have the custom fields in s2 merge into mailchimp. I do have the basic integration working fine, but I can’t seem to get anything other than name, email, time and ip to carry.

keepourforestopen.org

NOT A MULTI-USER ENVIRONMENT: I’ve created a file h2-hacks.php and it’s located as such – /wp-content/plugins/s2-hacks.php

<?php
add_filter("ws_plugin__s2member_mailchimp_merge_array", "my_filter", 10, 2);
function my_filter($merge, $vars)
    {
// $merge /* Array of existing MERGE fields that s2Member passes by default. */
// $vars /* Array of defined variables in the scope/context of this Filter. */

		$user_id = $vars["user_id"];
        // print_r($vars); // Lots of good stuff in this array.

		$user_st_address = get_user_field("st_address", $user_id);
		$user_city = get_user_field("city", $user_id);
		$user_state = get_user_field("state", $user_id);
		$user_zip_coode = get_user_field("zip_code", $user_id);
		$user_phone = get_user_field("phone", $user_id);

		$my_custom_merge_vars = array(
				"ST_ADDRRESS" => $user_st_address, 
				"CITY" => $user_city, 
				"STATE" => $user_state, 
				"ZIP_CODE" => $user_zip_code, 
				"PHONE" => $user_phone);

        return array_merge($merge, $my_custom_merge_vars);
    }
?>

I really did research the forums for hours and hours, but I just don’t seem to be making headway.

Thanks in advance.

  • This reply was modified 4 years, 6 months ago by  Marcos Figueroa. Reason: added website
Posted: Tuesday Jul 3rd, 2012 at 7:11 am #18169

I’ve created a file h2-hacks.php and it’s located as such – /wp-content/plugins/s2-hacks.php

Could you try it in the must-use plugins folder? /wp-content/mu-plugins/s2hacks.php

Let me know if it work, please. :)

Posted: Tuesday Jul 3rd, 2012 at 1:41 pm #18205

OH MY GOSH!!! Thank you so much!!

Hours and hours spent working on this and I had it right at the beginning…mostly! Since I’m so new to this world…I didn’t know the mu-plugins folder was a “must use” folder… I assumed it was the plugin folder for multi user (old multisite). Dang!

I’ll NEVER make that mistake again! Learning Pains!!!

Thank you so much for your very generous and kind help (even if you snickered under your breath…”newbie”!!! haha!

I really do appreciate it!

Oh, and yes… It worked like a champ. I had to fix a few glaring errors I made when I was half asleep (field names), but it works!!!

There is one field I’m attempting to export… Username… but I’ve not been successful, yet! Any chance you know the appropriate field name?

Thanks!

Marcos

Posted: Tuesday Jul 3rd, 2012 at 1:55 pm #18207

I got it!!!

user_login calls the username!

I’ll attach my completed code that is pulling over everything I want into MailChimp so others can hopefully benefit. I do believe that this hack only works on new registrations. It won’t work on updates or even transitioning… Is this correct, Cristian? I believe this function is being integrated into the next major release… Is that correct?

Here goes:

Also… it must be placed in the following location on your install: /wp-content/mu-plugins/s2-hacks.php
(This stands for MUST USE PLUGINS – if the mu-plugins folder doesn’t exist – create it)

My working Code:

<?php
add_filter("ws_plugin__s2member_mailchimp_merge_array", "my_filter", 10, 2);
function my_filter($merge, $vars)
    {
// $merge /* Array of existing MERGE fields that s2Member passes by default. */
// $vars /* Array of defined variables in the scope/context of this Filter. */

		$user_id = $vars["user_id"];
        // print_r($vars); // Lots of good stuff in this array.

		$user_address = get_user_field("address", $user_id);
		$user_city = get_user_field("city", $user_id);
		$user_state = get_user_field("state", $user_id);
		$user_zip = get_user_field("zip", $user_id);
		$user_phone = get_user_field("phone", $user_id);
		$user_login = get_user_field("user_login", $user_id);

		$my_custom_merge_vars = array(
				"ADDRESS" => $user_address, 
				"CITY" => $user_city, 
				"STATE" => $user_state, 
				"ZIP" => $user_zip, 
				"PHONE" => $user_phone, 
				"USERNAME" => $user_login);

        return array_merge($merge, $my_custom_merge_vars);
    }
?>

Thank you to Jason & Christian for the help!

Cheers!

Posted: Tuesday Jul 3rd, 2012 at 1:59 pm #18208

I do have one other question, Christian…. or anyone…

Will this work (export to MailChimp) if I upload an import into s2Member via your import feature?

Or will I need to import into both, s2Member and MailChimp to start?

Thanks,

Marcos

Posted: Tuesday Jul 3rd, 2012 at 2:30 pm #18213

After testing:

  • This works great on new records being created in s2Member…everything carries over to MailChimp!
  • Looks like it will transition membership levels(s2Member) – changing the list group associated with subscriber (MailChimp)
  • It will NOT however change any other information… Name, address, phone, etc…
  • If you change the email, it will NOT transition…since MailChimp’s unique identifier is the email.
  • It appears that MailChimp maintains the additional fields and just updates list group associated… removing them from one and subscribing them to another.
  • It WILL delete a record in MailChimp if deleted in s2Member!
  • You must check the: Re-process List Servers: [?] [] Yes, send a mailing list confirmation email to this User. – for any of this to happen. It will only transition the record the first time you change it in s2Member…so make sure this is checked!
  • Does NOT sync to MailChimp when doing a mass import.
  • Thats it! :-)

    • This reply was modified 4 years, 6 months ago by  Marcos Figueroa. Reason: updated a functionality
    • This reply was modified 4 years, 6 months ago by  Marcos Figueroa.
    Posted: Wednesday Jul 4th, 2012 at 7:04 am #18265

    Great Marcos! I’m glad you figured it out. Thanks for the update!

    You can reprocess the list servers with your own script, probably called by one of your notifications. This may be useful: http://www.s2member.com/forums/topic/s2member-mailchimp-and-ccaps/#post-17078

    I hope it helps. :)

    Viewing 8 replies - 1 through 8 (of 8 total)

    This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

    Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

    Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.