Membership One Payment for date range

I'm using One Payment for date range access membership, and I want the membership to date access to be change accordignly each year right after the end date is reahed with a renewal message being prompted to the members asking them to pay for the new year membership.
What I have now is that the membership expires on 9/30 every year regardless of when they decide to sign up. When I set up the membership there was no option for a date specific renewal. so if jane signs up on 10/4 & joe signs up on 3/2 it expires on 9/30 for both of them.

I have found this thread that might help, I'm not sure if it's exactly the same issue. https://premium.wpmudev.org/forums/topic/specific-renewal-dates-1-off-first-time-discounts

  • Nahid

    Hey Regent School PTO !
    Hope you are having a great day!

    I have escalated this request to our Second Level Support team. They'll be back to us with confirmations if something like this would be possible with Membership 2 Pro, clues and workarounds (if possible) in this ticket (or we'll be updating the ticket as soon as we hear back from them internally).

    Please note that the response time of the Second Level Support team or developers might be a bit delayed than that of the general support staff. Moreover, we are not able to initially confirm that something like this would be possible until members from the Second Level Support team looks into it. We really appreciate your patience and consideration regarding this.

    Kind regards,
    Nahid

  • Panos

    Hi Regent School PTO ,

    You could try adding the following snippet in a mu-plugin:

    add_filter( 'ms_model_relationship_set_expire_date', function( $expire_date, $subsciption ){
    
    	$expire_date = date('Y') . '-09-30';
    
    	if( strtotime( date( 'Y-m-d' ) ) > strtotime( $expire_date ) ){
    		$expire_date = date( 'Y-m-d', strtotime( $expire_date . '+ 1 Year' ) );
    	}
    
    	return $expire_date;
    }, 10, 2 );

    This should set expire date for each new subscription to 30nth of Sep. However this will not work for recurring payments, as these are calculated and paid directly from gateway.

    Hope this helps :slight_smile:

    Cheers!

  • Dimitris

    Hello there Regent School PTO,

    hope you're doing good today and don't mind chipping in! :slight_smile:

    MU-plugins (or else, must-use plugins) are some "special" plugins that's always active.
    These are located in /wp-content/mu-plugins/ folder.
    If this folder isn't created already in your server, then please go ahead and create it.
    After doing so, create a new PHP file inside it, like /wp-content/mu-plugins/m2pro-expire-date.php and insert the exact following snippet in it (be careful not to insert any empty lines or spaces at the beginning of this file):

    <?php
    add_filter( 'ms_model_relationship_set_expire_date', function( $expire_date, $subsciption ){
    
    	$expire_date = date('Y') . '-09-30';
    
    	if( strtotime( date( 'Y-m-d' ) ) > strtotime( $expire_date ) ){
    		$expire_date = date( 'Y-m-d', strtotime( $expire_date . '+ 1 Year' ) );
    	}
    
    	return $expire_date;
    }, 10, 2 );

    Reference: https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Warm regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.