Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @wahyu_anggg,

    Thanks for your question and yes that’s possible!

    For reference, you’ll find lots of helpful class methods in the following folder:

    \membership\membershipincludes\classes\class.membership.php

    In there, you’ll see methods like the following:

    function current_subscription()
    function has_subscription()
    function move_to($sub_id, $thislevel_id, $thislevel_order, $nextlevel)

    And specifically, I believe you’ll want this one:

    function drop_subscription($fromsub_id)

    Given that, you could use a function like this to unsubscribe:

    function remove_subscription_from_member ( $user_id, $sub_id ) {
    	if ( class_exists( 'M_Membership' ) ) {
    		$member = new M_Membership($user_id);
    		$member->drop_subscription($sub_id);
    	}
    }

    You then call the function with the user id for the member, and the id of the subscription.

    How’s that work for you? 🙂

    Cheers,
    David

    Thread Starter wahyu_anggg

    (@wahyu_anggg)

    Hi @david

    thanks for your help..
    it works very well 🙂

    before you give this code, I used javascript, and it was not work very well.

    thanks David 🙂

    Cheers,
    Wahyu

    Hi Wayhu,

    You’re most welcome, glad that helps. 🙂

    Any further questions, please feel free to ask. We’re happy to assist!

    Cheers,
    David

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

The topic ‘Unsubscribe user using php script’ is closed to new replies.