[MP2] Expired memberships

I still have issues with users with a membership in "expired" status, that are still able to access the protected content.
A guy I know personally thought he had paid last year when his subscription had expired. I wrote twice reminding him to pay which he never did. Today he wrote me asking a question and I reminded him that his subscription had expired in Nov '18 and he said he had access all this time and indeed showed as being logged in.

  • Kris
    • Support

    Hi AMS

    I'm sorry to hear that you are experiencing this issue.

    I escalate this issue to our SLS Team (code experts) so that they can dig into this issue further for you. We will post an update here as soon as more information is available.

    Thank you for your patience while we look into this further.

    Kind Regards,
    Kris

  • Panos
    • SLS

    Hi AMS !

    Thanks for sharing access to your site!

    I had a look and noticed that you have disabled WP Cron by setting the DISABLE_WP_CRON constant to true. Membership plugin relies on cron events to check the subscription statuses so that's why they are not being changed to expired.

    Is there any specific reason that you have disabled that? If you really need WP Cron disabled, perhaps you could add a real cron job via your CPanel if supported to run the ms_cron_check_membership_status which will trigger the status check. For this you need to first create a page with a rewrite rule that you can visit with the cron job. Here is an example snippet that creates a custom rewrite rule for http://site.com/ms_cron_tasks/ms_custom_status_check/:

    add_action( 'init', function(){
    
    	$webhook 		= 'ms_cron_tasks';
    	$webhook_tag 	= 'ms_custom_status_check';
    	//To use like http://site.com/ms_cron_tasks/ms_custom_status_check/
    	add_rewrite_tag( '%' . $webhook_tag . '%', '([^&]+)' );
    	add_rewrite_rule( '^' . $webhook . '/([^/]*)/?', 'index.php?' .  $webhook_tag . '=$matches[1]', 'top' );
    
    } );
    
     add_action( 'parse_request', function( &$wp ){
    
     	$webhook_tag 	= 'ms_custom_status_check';
     	$action 		= 'ms_custom_status_check_hook';
     	if ( array_key_exists( $webhook_tag, $wp->query_vars ) ) {
            do_action( 'ms_cron_check_membership_status' );
            die(0);
        }
     } );

    You can add the above snippet in a mu-plugin and then go to your Permalink settings and click the Save button (in order to reset permalinks). If you are not familiar with mu-plugins you can read about them here :
    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    Once done, each time you visit page:
    http://site.com/ms_cron_tasks/ms_custom_status_check/
    it will trigger the action that runs the subscriptions status check.

    You can use that url in your cron job like:
    0 */6 * * * wget -O - http://site.com/ms_cron_tasks/ms_custom_status_check/ >/dev/null 2>&1

    Hope this helps!

    Kind regards!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.