mirror of
https://github.com/pronamic/woocommerce-subscriptions.git
synced 2025-10-16 14:22:56 +00:00
2.2.10
This commit is contained in:

committed by
Remco Tolsma

parent
09e7f71161
commit
ed27f81d70
@@ -41,6 +41,22 @@ function wcs_maybe_make_user_inactive( $user_id ) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for wcs_maybe_make_user_inactive() that accepts a subscription instead of a user ID.
|
||||
* Handy for hooks that pass a subscription object.
|
||||
*
|
||||
* @since 2.2.9
|
||||
* @param WC_Subscription|WC_Order
|
||||
*/
|
||||
function wcs_maybe_make_user_inactive_for( $subscription ) {
|
||||
wcs_maybe_make_user_inactive( $subscription->get_user_id() );
|
||||
}
|
||||
add_action( 'woocommerce_subscription_status_failed', 'wcs_maybe_make_user_inactive_for', 10, 1 );
|
||||
add_action( 'woocommerce_subscription_status_on-hold', 'wcs_maybe_make_user_inactive_for', 10, 1 );
|
||||
add_action( 'woocommerce_subscription_status_cancelled', 'wcs_maybe_make_user_inactive_for', 10, 1 );
|
||||
add_action( 'woocommerce_subscription_status_switched', 'wcs_maybe_make_user_inactive_for', 10, 1 );
|
||||
add_action( 'woocommerce_subscription_status_expired', 'wcs_maybe_make_user_inactive_for', 10, 1 );
|
||||
|
||||
/**
|
||||
* Update a user's role to a special subscription's role
|
||||
*
|
||||
|
Reference in New Issue
Block a user