Grace Period to Expiring Websites

As discussed in this thread: https://premium.wpmudev.org/forums/topic/prosites-with-stripe-is-killing-my-users-sites-monthly#post-967231

I would like to know of a solid, bug-free solution to adding in a grace period for expiring websites. Sometimes PayPal fails to run the card, or the card fails to process (user's end issue), and their site immediately shuts off. I would like to add 7 days grace period to all expiring sites.

I can not grant access to the site or FTP, because we have 1300+ current clients and I can't afford to have anything accident'ed. Please, if you know the code change or additions, post them here.

  • Michael Bissett

    Hey @Jeremy, Michael here!

    The trick here is that you're running version 3.4.7.2 of Pro Sites, whereas the current release is 3.5.1.3 (a good 10 months ahead, in terms of updates), and I believe that the poster there was using a version that was later than the one you have now.

    In the version of Pro Sites you have, the code mentioned in the 1st half the comment in question on the thread you referenced:

    https://premium.wpmudev.org/forums/topic/prosites-with-stripe-is-killing-my-users-sites-monthly#post-931344

    Would instead exist on lines 1258-1271 of:

    /pro-sites/pro-sites.php

    Borrowing from the thread, you can try changing the code in the lines I mentioned there, with this code:

    function get_expire( $blog_id = '' ) {
    		global $wpdb;
    
    		if ( empty( $blog_id ) ) {
    			$blog_id = $wpdb->blogid;
    		}
    		$grace_time=168*60*60; // set 7 day grace period
    		$expire = $wpdb->get_var( $wpdb->prepare( "SELECT expire FROM {$wpdb->base_prefix}pro_sites WHERE blog_ID = %d", $blog_id ) );
    		if ( $expire ) {
    			return $expire+$grace_time;
    		} else {
    			return false;
    		}
    	}

    My advice to you would be to test out the changes on a test Multisite of yours, so that in case something does go wrong, your main network doesn't get taken down.

    In the meantime though, the idea of creating a filter to adjust the grace period comes to mind, and it's something I can bring up to the developer, this would be for a later release than what you have installed though.

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.