Skip Navigation

[Resolved] Make content expire when a subscription expites

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2474887

I have set up a directory. Members pay to have listing on the directory, which is in turn hooked up to WooCommerce subscriptions. Everything works well except whenever a subscription expires the content (directory listing) associated with the user is still active. Maybe I've missed this on the documentation but how can I set the content associated with a user to expire when the subscription ends? An inactive subscriber moves from being a "Member" to being a "Customer".

#2475253

Hi,

Thank you for contacting us and I'd be happy to assist.

I've done some research online, and the WooCommerce Subscriptions don't seem to include this feature. On subscription expiration, it can change the role of the user, but not the status of his/her content/posts.

To achieve this, you'll need to include some custom code. For example, you can use the WooCommerce Subscriptions' 'woocommerce_subscription_status_updated' hook to detect the changes in the user's subscription status:
https://woocommerce.com/document/subscriptions/develop/action-reference/#section-2

This custom function will need to cycle through all the posts where that user is the author and change their status so they're no longer 'published'.

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#2477481

Thanks. I think I can get that to work.