What's a quick and dirty way to get "lapsed" members in WordPress configured with s2Member?

I have a default installation of WordPress configured with the membership management plugin known as s2Member. What is a quick and dirty way to return an array of "lapsed" members?

I assume this information is hidden somewhere in the user's metadata.

Solutions

You can search for the "demoted" note that s2Member logs:

$lapsedMembers = $wpdb->get_results(
    $wpdb->prepare("
        SELECT
            DISTINCT (`u`.`ID`),
            `u`.`display_name`    `name`,
            `u`.`user_email`      `memberemail`,
            `u`.`user_registered` `enrollmentdate`,
            `um`.`meta_value`     `lapsereason`
        FROM
            {$wpdb->users} u
            LEFT JOIN {$wpdb->usermeta} um ON u.ID = um.user_id
        WHERE
            um.meta_key = %s
            AND um.meta_value LIKE % s
    ", 'wp_s2member_notes', '%Demoted%'),
    ARRAY_A
);
Tags: PHP / Mysql / Wordpress

Similar questions

Setting dirty on customizer
When you are using the wordpress customizer, if you don't make any changes to the settings, the wordpress customizer doesn't enable the publish button. And it shows like this: And I want it to be displayed like this after I make a change from my custom customizer control which is an input not linked to the customizer: How can I enable the disabled ...
Can some one decode this dirty code?
One of my friend's wordpress website is hacked by someone and they put the following code on the header of all template files. http://pastebin.com/dYcQ1Gri I tried to decode it with base64 decoder. But the output looks odd. Can you guys tell me what type of encoding is this?
redirect from /members/front to /members/custom
Im not trying to redirect user while logging in, thats already done. I want everybody, logged or not-logged in, to being redirected from members homepage/dashboard where I can see now 'Latest updates' to another custom tab, but lets say to Friends. Whats the best way to achive it? because i cant find similar problem and missing something when i try...
Buddypress Show a members most recent post in members loop
In my list of members, I show the standard fields of avatar, username, profile data, etc - this all works fine. I'd like to also show the 'most recent post' from that user too. Is there a snippet I can use to grab the most recent post from that author? Somehow identifying which author it is and their most recent post? Thanks, Ian
Buddypress - getting members loop to print members in specific order by specific criteria
I am building a site for students to find teachers. I want to be able to filter the teachers based on custom criteria. One of the criteria I'd like to be able to filter them by is user ratings. I have written a custom function to get the exact order of members I want displayed, in this case by user rating. I know that in using bp_has_members, you c...
Show members of members group
I want to show all members of the group in which the user is also member. For this, I want to use the buddypress members loop: http://codex.buddypress.org/developer/loops-reference/the-group-members-loop-bp_group_has_members/ As a permitted parameter, I try to get the group_id and start the members loop, but I always get the output "This group has ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.