Membership subscription status

In Membership 2 -> All members, "Subscription Status" links (Active | Cancelled | Expired) shows 270 members, when there is only 1 member (Based in Membership 2 -> Memberships).

Also, navigating in the links loads different results too. I had issues importing members, can this be related too:

https://premium.wpmudev.org/forums/topic/membership-i-cant-import-members-from-one-site-to-another

  • Predrag Dubajic
    • Support

    Hi Reece Carpenter,

    Hope all is well.

    I was looking at your installation and it seems like the memberships are correct but the calculation for the numbers are wrong for some strange reason.

    If you go to Membership 2 > All Members and switch filters there it will show the same number everywhere as the filter you're on, but the number on current filter is actually correct.
    For example, if you go to Active memberships it will show 265 which is correct, then if you switch to canceled it will show 2 everywhere but there are actually 2 canceled members.
    So the numbers are correct but shown in other filters as well.

    I was unable to replicate this on my installation however but would like to check if this could be related to importing members.

    Could you upload your export file, from the source site, to any file sharing service like DropBox or Google Drive and send me the download link by using our contact form https://premium.wpmudev.org/contact/#i-have-a-different-question and the template below:

    Subject: "Attn: Predrag Dubajic"
    - Download link
    - Link back to this thread for reference
    - Any other relevant urls/info

    Best regards,
    Predrag

  • Lindeni Mahlalela
    • Recruit

    Hello Reece Carpenter

    I hope you are doing great today. We are very sorry for the delayed response and sorry for the inconvenience caused.

    I have checked the code of the Membership 2 Pro plugin and found that the issue is that the plugin sets a cached value of the membership count and then reads from this cached value later. The problem is that it sets the same key for all the status codes while it should store each one separately. We were able to confirm the issue is related the the setting to "Speed up results" setting in "Membership 2 > Settings > General" page, if this setting is turned on then the issue occur. I have applied a fix for this on your website so now it seems to be working fine.

    Here is what I have changed in the code: In the file 'membership/app/model/class-ms-model-member.php', in the function 'get_members_count' I have changed the line:

    $cache_key = MS_Helper_Cache::generate_cache_key( 'ms_model_members_total'], $args );

    To

    $cache_key = MS_Helper_Cache::generate_cache_key( 'ms_model_members_total_' . $args['subscription_status'], $args );

    So the function looks like this at the top:

    public static function get_members_count( $args = null ) {
    	$total 		= 0;
    	$cache_key 	= MS_Helper_Cache::generate_cache_key( 'ms_model_members_total_' . $args['subscription_status'], $args );

    This should make sure that Membership 2 Pro stores the cached counts separately for each subscription status and the cache keys will be like this:

    ms_model_members_total_active
    ms_model_members_total_canceled
    ms_model_members_total_expired

    And each of these will have the appropriate members count. I have already applied the fix on your website and have submitted to developers so that it can be included in future versions. Please note that this is not an official fix and it may or may not be included in the next release so before you update the plugin in the future, check the changelogs to see if the fix is included or not. You can still update and apply the fix manually by changing the code as outlined above.

    I hope this helps. Please test on your side and let us know if you have any further issues regarding this issue and we will always be happy to help in any way possible.

    Have a nice day.
    Lindeni

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.