Does Membership 2 Pro, sync memberships for Users across MultiSite Environments?


I'm really interested in implementing Membership 2 Pro, but I have a quick question about the MultiSite Environment. I understand that I can have the same rules for specific content across multiple sites, but does this plugin automatically sync users across multiple sites. For example.
Scenario 1.
I have a site for Bowling, and a Second site for Tennis. A user signs up for the Gold plan on the Tennis Site, I want them to immediately have access to the Gold Plan on the Bowling Site as well.
Scenario 2.
Using the two sites from Scenario 1, A user signs up for the Silver Plan on the Tennis Site, which includes the Bronze Plan on the Bowling Site.

Is either of these scenarios able to be accomplished through Membership 2 Pro, and or additional Plugins that WPMUDev produces?

  • Vaughan
    • Support/SLS MockingJay

    Hi @caritasdesigns,

    Hope you're well?

    This can't be done out of the box and would require some custom code to achieve, but it should be possible.

    I haven't tested this, but adding the following to a mu-plugin might do the trick with a little adjustment.

    add_action( 'ms_model_relationship_create_ms_relationship_before', 'ms_controller_member_assign_memberships_done_cb', 99, 4 );
    function ms_controller_member_assign_memberships_done_cb( $membership_id, $user_id, $gateway_id, $move_from_id ) {
        $second_blog_id = 2; // enter the blog_id of your second site you want to assign membership to.
    	$target_membership = '';
    	switch( $membership_id ){
    		// if membership on main blog is 123
    		// then assign to 456 on second blog.
    		case 123:
    			$target_membership = 456;
    		// if first membership 321
    		// then assign to 654
    		case 321:
    			$target_membership = 654;
    		//and so on...
    	$member = MS_Factory::load( 'MS_Model_Member', $user_id );
    	$subscription = $member->add_membership( $target_membership );
    	if ( $member->has_membership() ) {
    		$member->is_member = true;
    	} else {
    		$member->is_member = false;

    Enter the blog_id of your second site where it says $second_blog_id.

    Now you'll need to get the membership plan id's for your membership plans on each site & enter them for each case above.

    if gold membership_id on main site is 123

    then enter 123 for the first case 123: so change the 123 to the membership id

    if silver is 234 on the second site, then enter 234 in the $target_membership value.

    to use this in a mu-plugin, first create a file called custom_m2p_membership.php

    Now add the above code to that file, once done, upload it to /wp-content/mu-plugins (if mu-plugins doesn't exist, create it)

    As I say, I haven't tested it, so it's best to try this first before you go live with it.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.