I have a site I'm working on where users pay a monthly fee to be able to add content to the site and they are assigned a custom user role when registered. When their subscription is up their user role is changed to a subscriber. It's using Gravity Forms and their authorize.net plugin for the subscription.
// Set user role to subscriber after subscription expires
add_action( 'gform_authorizenet_subscription_canceled', 'downgrade_user_role', 10, 4 );
function downgrade_user_role( $entry, $subscription_id, $transaction_id, $new_payment_amount ) {
$user = GFUserData::get_user_by_entry_id( $entry['id'] );
$user->set_role( 'subscriber' );
}
I'm then trying to figure out how to change the post status once their subscription is up so the content wouldn't be active unless their subscription was. I was thinking of changing the post status to draft when the user role is changed to a subscriber but not sure how to go about doing that.
Another option would be to only include the posts by certain user roles in the query but haven't been able to find a way to do that either.
Anyone have any thoughts or ideas on how I could achieve this? Thanks