Make the Upgrade paths to deny initially

When you create a new membership in Membership 2 Pro. It automatically allows all existing memberships in the upgrade path. It will be helpful if it is turned off for all initially and I could choose the one I will allow.

  • Adam Czajczyk

    Hello Ingenieurbüro Dr. Plesnik GmbH

    I hope you're having a good day today!

    The "upgrade paths" currently are all set to "allowed" by default and there's no "out of the box" way to change it. I also didn't found any "direct" way to change this default options with some additional code, I'm afraid, other than "hacking" the plugin code directly.

    However, I found some filter in the plugin that I hope may be of help but I need to consult that with our developers. I've passed the question to them and am awaiting their response so please keep an eye on this ticket and we'll update you here as soon as we get to know more on this.

    Kind regards,
    Adam

  • Panos

    Hi Ingenieurbüro Dr. Plesnik GmbH ,

    Not sure if a button that would set the Upgrade Paths for all memberships would help. If you are interested, you can try out this mu-plugin :
    https://gist.github.com/wpmudev-sls/13934eef91d7a57cb90b2b0af61d0be6

    After download, unzip it and upload the ms-deny-membership-upgrade.php file to the wp-content/mu-plugins folder. If that folder doesn't exist you can simply create it.

    After the upload, you should see a new link/button with text Deny Upgrades at the footer of the Membership Settings page
    site.com/wp-admin/admin.php?page=membership2-settings

    After clicking that, it should try and set all Upgrade Paths for all Memberships to deny.

    If you want to exclude some membership_ids, you can add the ids in array in line 70, for example change it from
    $excluded_membership_ids = apply_filters( 'WPMUDEV_MS_Deny_Upgrade/excluded_membership_ids', array() );
    to :
    $excluded_membership_ids = apply_filters( 'WPMUDEV_MS_Deny_Upgrade/excluded_membership_ids', array( 256, 786, 954 ) );
    to exclude memberships with ids 256, 786 and 954.

    I would strongly suggest to test this first in a staging site.

    After you are done, you can delete that file.

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.