Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription status not expiring #11

Open
mikemike opened this issue May 12, 2021 · 0 comments
Open

Subscription status not expiring #11

mikemike opened this issue May 12, 2021 · 0 comments

Comments

@mikemike
Copy link

Members are given an expiry, stored in the database as 'expire_date' in wp_postmeta.

I want to get a list of members in a query that have active subscriptions (not expired). I'm aware of subscription_status as an argument to MS_Model_Member::get_members, but that isn't working, either because status isn't changing to expired or because it's bugged.

I've also tried manually comparing using a meta_query but unfortunately it looks like the expire_date is stored against a post, not a user, and MS_Model_Member::get_members ultimately calls WP_User_Query.

Below is my query:

$args = array(
    //'membership_id' => 18, // 18,31
    'subscription_status' => 'active',
    'orderby' => 'meta_value', // company_name     
    'order' => 'ASC',
    'meta_key' => 'company_name',
    'number' => $per_page,
    'offset' => $offset,
    'count_total' => true,
    'meta_query' => array(
        array( // Means they must be a valid member
            'key' => 'company_name',
            'value' => '',
            'compare' => '!='
        ),
    )
);

And I have tried including a second query param for expire_date:

$args = array(
    //'membership_id' => 18, // 18,31
    'subscription_status' => 'active',
    'orderby' => 'meta_value', // company_name     
    'order' => 'ASC',
    'meta_key' => 'company_name',
    'number' => $per_page,
    'offset' => $offset,
    'count_total' => true,
    'meta_query' => array(
        array( // Means they must be a valid member
            'key' => 'company_name',
            'value' => '',
            'compare' => '!='
        ),
        array( 
            'key' => 'expire_date',
            'value' => date('Y-m-d'),
            'compare' => '>'
        ),
    )
);

So I guess my question is, how do members 'expire'? I believe the WP cron to be running as expected. Anything else I should be aware of?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant