Manually change expiry date of members

@adminHI

I have imported all my current users into the M2 pro plugin and they are all appearing as visitors.
My questions are:

1) Is there a way to change them all to a certain membership category
2) Is there a way to manually change the expiry date?
2a) is there a way to do this as a batch
2b) is there a way to do this on an individual basis.

This is so when the membership expires they will then receive an automatic email to re-insert their payment details, which will then be handled by M2?

Thanks

Dan

  • Michelle Shull

    Hi there, Dan!

    1) Is there a way to change them all to a certain membership category

    In a batch, via the plugin, no, they'd need to be added individually. If you're comfortable working with MySQL, you could write a query to add each user to a specific membership level, but we don't have a way to batch add users to a particular membership.

    2) Is there a way to manually change the expiry date?
    2a) is there a way to do this as a batch
    2b) is there a way to do this on an individual basis.

    The only way to change the current expiration date is via the database, we don't have a way for you to manually do so within the plugin itself, either one-by-one or in batches.

    If you decide to work with the database, start by taking a backup.

    Membership 2 no longer uses it's own custom tables, it integrates the data that needs to be stored in the database into the wp_options and wp_postmeta tables. I've asked my colleague @Jack Kitterhing to provide more detailed instructions here for running a query to change this data.

    If you don't want to use the database, I've got a workaround for you. You'll need to manually move members to a new membership, which can be tedious, but Membership2 will save as you go, so no need to wait for your site to save and reload after each level change. Set the new membership to be finite, with the length of the subscription set to end when you want the new expiration date to be. In the payment settings for that finite membership, set the level the user will be moved to after the subscription ends to be the subscription you want them to have.

    From there, you can set up an automatic response when a member is added to the level you've assigned for the end of the finite membership, which asks for subscription details to be re-entered.

    Does that make sense?

  • Jack Kitterhing

    Hi there @Dan,

    Hope you're well today, first to find the subscriptions to update, you can run this:

    SELECT
    	expire.meta_id,
    	sub.ID,
    	stat.meta_value AS 'Status',
    	expire.meta_value AS 'Expires',
    	member.meta_value AS 'User_id'
    FROM wp_2_posts sub
    INNER JOIN wp_2_postmeta member ON member.post_ID = sub.ID AND member.meta_key = 'user_id'
    INNER JOIN wp_2_postmeta expire ON expire.post_ID = sub.ID AND expire.meta_key = 'expire_date'
    INNER JOIN wp_2_postmeta stat ON stat.post_ID = sub.ID AND stat.meta_key = 'status'
    WHERE
    	sub.post_type = 'ms_relationship'
    	AND stat.meta_value = 'active'
    	-- Modify the WHERE condition until you get the required rows
    ;

    And then this

    UPDATE wp_2_postmeta AS expire
    	INNER JOIN wp_2_posts sub ON sub.ID = expire.post_ID AND expire.meta_key = 'expire_date'
    	INNER JOIN wp_2_postmeta member ON member.post_ID = sub.ID AND member.meta_key = 'user_id'
    	INNER JOIN wp_2_postmeta stat ON stat.post_ID = sub.ID AND stat.meta_key = 'status'
    SET expire.meta_value = '2016-12-31'
    WHERE
    	sub.post_type = 'ms_relationship'
    	AND stat.meta_value = 'active'
    	-- Use the same WHERE condition as in the above query
    ;

    The First query is to check/find the rows you need to update.
    Once you have the correct WHERE condition you can use the second query to update those rows - simply copy-paste the WHERE condition from frist query to the second query.

    Please remember to take a database backup before running any SQL, also you may need to update the tables above, as they are wp_2_postsmeta, as they queries are from a multisite, wp is the table prefix, 2 is the site ID, so if you are on a single site, just remove the 2 and replace wp with your correct database prefix.

    Thanks!

    Kind Regards
    Jack.