• Hello, I found this code in your forum

    add_action( 'user_register', function( $user_id ){
    	$member = MS_Factory::load( 'MS_Model_Member', $user_id );
    	if ( $member ) {
    		$subsription = $member->add_membership( 1015 );
    	}
    } );

    This is half working, in the sense that any new user is getting his membership. but actually the protection rules are not applying to him.
    He’s assigned in the backend, but in the front end he’s closed out from any page.

    If I assign as admin a new membership by hand, then it’s working.
    It seems that the automation is missing to put the member in some tables…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello Mauroit,

    I don’t know if my issue is related to what you experienced, although I am seeing members who sign up but are not given a membership.

    When a new user signs up as a member they see the Account page, but their “Your Membership” box says “No memberships” even though they did sign up. One way to fix it is for the user to click the Change button, select their membership type again, and click the button to sign up – this returns them to the Account page, where their chosen membership now appears. I think most users would definitely not want to do this or even realize it is possible, especially if they previously chose a paid membership type.

    I did come across something on the WPMUDEV site concerning caching. I am not able to use it as I don’t have a caching plugin on the site. You might give it a try, though.

    ***
    Known Issues
    Cache plugins can often interfere with plugin functionality. If your users are not being assigned memberships after successfully paying and logging into your site, check if you have object cache enabled in your cache plugin. If so, add the following to the non-persistent fields/groups?MS_Model_Membership?MS_Model_Member?MS_Model_Communication_Invoice

    https://premium.wpmudev.org/forums/topic/membership-not-fully-assigned-in-some-cases

    ***

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mauroit ,

    Indeed this code no longer works as expected. It is because the code was prepared for an older version of the plugin.
    I will check with our devs, how it’s possible to change this code to make it work.

    kind regards,
    Kasia

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign membership to any new member’ is closed to new replies.