Integrating s2member & Infusionsoft

 

When it comes to Infusionsoft powered membership sites, there are only really two options. iMember360 and Memberium. But, there are literally hundreds of membership site platforms out there for WordPress, each with their own cool features and quirks.

For our membership site, we went with s2member (despite it not integrating with Infusionsoft).

Why, you may ask? Well… because it was REALLY EASY TO SETUP. s2member is by far the most stable, most documented, and most popular membership platform out there with millions of downloads and users.

But it doesn’t integrate with Infusionsoft!

Well,  since we wanted Infusionsoft to speak to our membership site, we put together a little plugin to help us do that.

What it does:

  1. It will apply a “FREE” tag to a contact when they register as a free member
  2. It will apply the appropriate membership level tag when registering as a PAID member
  3. It will apply and remove tags accordingly when someone upgrades/downgrades their account.
  4. The plugin is setup to include s2member fields like First Name, Last Name, and Company, but you can change those/add more/ remove to your liking as long as you follow the naming convention that’s already there!

What You Need To Do:

  1. Create tags in Infusionsoft that correspond to membership levels in s2member
  2. Edit the plugin file where it says
    //TODO edit Tag ID's
  3. Download and setup one of the following FREE plugins which has the Novak solutions SDK.
    1. FormLift (Also does mobile responsive web forms & is most recent/up to date)
    2. Novak Solutions SDK (just the SDK)

And then you’re ready to go! Activate your customized plugin file and that’s it!

See it below. Warning, code ahead!

Or click here to skip the code…

<?php

/*
Plugin Name: s2member Infusionsoft Integration
Plugin URI: https://www.trainingbusinesspros.com
Description: Integrate Infusionsoft with s2member
Version: 1.0
Author: Adrian Tobey
Author URI: https://www.trainingbusinesspros.com
License: GPL2
*/

/**
 * Instructions for installation
 *
 * Download and install 1 of the infusiosoft enable plugins listed. FormLift or Infusionsoft SDK by Novak
 * Change the tag IDs below to the tags you want to add based on certain subscription levels.
 */

//TODO edit Tag ID's

//start a particular campaign with this tag
define( 'S2M_TO_INF_CAMPAIGN_START_TAG', 1 ); // tag id

//the tag a contact gets when they become a level 1 member
define( 'S2M_TO_INF_CAMPAIGN_LEVEL_1', 1 ); // tag id

//the tag a contact gets when they become a level 2 member
define( 'S2M_TO_INF_CAMPAIGN_LEVEL_2', 1 ); // tag id

//the tag a contact gets when they become a level 3 member
define( 'S2M_TO_INF_CAMPAIGN_LEVEL_3', 1 ); // tag id

//the tag a contact gets when they become a level 4 member
define( 'S2M_TO_INF_CAMPAIGN_LEVEL_4', 1 ); // tag id

//the tag a contact gets when the become a free member
define( 'S2M_TO_INF_CAMPAIGN_FREE_TAG', 1 ); // tag id

// That's it. Stop editing unless you're a developer and enjoy that kind of thing.
// If you need some more robust functionality, our office is available to help you.
// Just send emails to [email protected] or call Directly at 416-444-777
// ============================================================

if( !class_exists('Infusionsoft_Classloader') ){
    add_action('admin_notices', 's2m_to_inf_admin_notice');
} else {
    add_action( 'user_register', 's2m_to_inf_register_user' );
    add_action( 'set_user_role', 's2m_to_inf_upgrade_user' );
}

function s2m_to_inf_admin_notice()
{
    ?>
<div class="notice notice-error">
    <p>There is no Infusionsoft SDK to work from. Please download and install 1 of the following FREE plugins to enable this extension. </p>
    <ul>
        <li><a href="https://wordpress.org/plugins/formlift/">FormLift: Infusionsoft Web form & WordPress Integration (includes Novak SDK)</a></li>
        <li><a href="https://wordpress.org/plugins/infusionsoft-sdk/">Infusionsoft SDK by Novak Solutions</a></li>
    </ul>
</div>
<?php
}

/**
 * Add a new user to our Infusionsoft account once they've registered for the membership site.
 *
 * @param $user_id int
 */
function s2m_to_inf_register_user( $user_id )
{
    if ( s2m_to_inf_is_s2m_role($user_id)) {

        $user = $contact = get_user_by( 'ID', $user_id );

        $contact = s2m_to_inf_get_contact_by_email( $user->user_email );
        if (!isset($contact)){
            $contact = new Infusionsoft_Contact();
        }

        $user_custom_fields = get_user_option('s2member_custom_fields', $user_id);

        $contact->FirstName = $_POST['ws_plugin__s2member_custom_reg_field_first_name'];
        $contact->LastName = $_POST['ws_plugin__s2member_custom_reg_field_last_name'];
        $contact->Company = $_POST['ws_plugin__s2member_custom_reg_field_company'];
        $contact->Email = $user->user_email;
        $contact->Username = $user->user_login;
        $contact->save();
...

To get the full plugin file,  click here…

Is all this gibberish to you? That’s okay, we’re here to help small business succeed with Infusionsoft and their digital marketing. Submit exactly what you need below and we’ll help you setup your s2member & Infusionsoft integration to do what you need it to!

[infusion_form id=”2081″]

Leave a Reply