Thank you for contacting us and I'd be happy to assist.
There are two different recommended paths when using Toolset with WooCommerce:
1. For products where only a one-time payment is involved:
In this path, you don't need WooCommerce Subscriptions and you can use a Toolset Form to complete the checkout process and accept the one-time payment, as explained in this guide:
2. For products where recurring payment is involved:
When recurring payments are involved, you'll need the WooCommerce Subscriptions. It will switch the user's role, based on whether the subscription is active or not, as explained in this guide:
Through two different user roles (for example, "Active subscriber" and "Inactive subscriber"), you'll be able to control which content, pages, and forms, a particular user can or can not, access, including the ability to add or edit listings.
As for your specific questions:
> If I must use WooCommerce Subscriptions, how will users be assigned/linked to the posts (directory listings) they create?
- On successful subscriptions, users will be assigned the "Active subscriber" role, which will grant them the ability to add a new listing(s) or edit their existing ones, using the Toolset Forms. Toolset Forms will automatically set that user as the author of the created listing post, which will act as a natural link.
> And how will the directory listings (custom posts) be automatically removed or publish status changed if the user does not renew the subscription?
- For this bit, you'll need some custom code, which can detect the change in the user's subscription status.
a). If the subscription status changes to anything other than "active", it should get all the listing posts where the current user is the author and change their post status to 'draft'.
b). Likewise, if the subscription status changes to 'active' from any other status, it should get all the listing posts where the current user is the author and change their post status to 'published'.
To execute this custom function when the subscription status changes, you can use the "woocommerce_subscription_status_updated" hook from the WooCommerce Subscriptions:
You'll find an example of a code snippet for a similar requirement in this support thread:
I hope this helps and please let me know if you need any further assistance around this.