Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Theunis Coetzee

    (@ipokkel)

    Hi @reynskie

    Thank you for using Paid Memberships Pro. I’m sorry to hear about the issue you are facing.

    The PMPro Roles Add on is not compatible with the Multiple Memberships Per User Add On.

    Unfortunately, we are not allowed to support premium plugins on www.remarpro.com forums as it goes against the guidelines.

    Please can you open a support ticket on https://www.paidmembershipspro.com and one of our support engineers will assist you with this query.

    Thank you for understanding.

    Thread Starter reynskie

    (@reynskie)

    hi
    thanks for the response.

    btw im able to get the code :

    function pmpro_after_change_membership_level($level_id, $user_id)
    {
    //get user object
    $wp_user_object = new WP_User($user_id);

    //ignore admins
    if(in_array(“administrator”, $wp_user_object->roles))
    return;

    if($level_id == 4)
    {
    //New member of level #2. Give them Bronze role.
    $wp_user_object->add_role(‘bronze_level’);
    }

    elseif($level_id == 3)
    {
    //New member of level #1. Give them Silver role.
    $wp_user_object->add_role(‘silver_level’);
    }
    elseif($level_id == 2)
    {
    //New member of level #1. Give them Gold role.
    $wp_user_object->add_role(‘gold_level’);
    }

    elseif($level_id == 5)
    {
    //New member of level #1. Give them Platinum role.
    $wp_user_object->add_role(‘platinum_level’);
    }

    elseif( $level_id == 0 ) {
    //Cancelling. Give them Subscriber role.
    $wp_user_object->set_role(‘subscriber’);
    }
    }
    add_action(‘pmpro_after_change_membership_level’, ‘pmpro_after_change_membership_level’, 10, 2);

    i used add_role instead of set_role – it works perfectly of what i’ve wanted.
    this way user assigned multiple roles.

    however when cancelling one of the level,
    e.g
    bronze role cancelled it will set the roles back to subscriber & the other roles get removed.

    is there a way only the bronze role will be removed and leave the other roles there ?

    Plugin Author Andrew Lima

    (@andrewza)

    @reynskie I have posted to your new thread in this forum regarding this question.

    As mentioned in your other ticket, you are able to use the ‘remove_role’ function.

    If you need help with this custom code you may reach out to a local WordPress developer.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Assign Remaining Role when canceling other membership’ is closed to new replies.