| @@ -20,8 +20,15 @@ | ||
| 20 | 20 | add_action( 'subscrpt_subscription_activated', [ $this, 'maybe_change_user_role_on_subscription_activation' ] ); |
| 21 | 21 | |
| 22 | 22 | add_action( 'subscrpt_subscription_expired', [ $this, 'maybe_change_user_role_on_subscription_deactivation' ] ); |
| 23 | 23 | add_action( 'subscrpt_subscription_cancelled', [ $this, 'maybe_change_user_role_on_subscription_deactivation' ] ); |
| 24 | + | |
| 25 | + // A failed renewal suspends the subscription rather than ending it, so the | |
| 26 | + // role has to come down here too. Nothing listened to this before, which | |
| 27 | + // left a customer who stopped paying holding their subscriber role for the | |
| 28 | + // whole retry ladder. Reversible: a recovered payment fires | |
| 29 | + // `subscrpt_subscription_activated`, which puts the role back. | |
| 30 | + add_action( 'subscrpt_subscription_on_hold', [ $this, 'maybe_change_user_role_on_subscription_deactivation' ] ); | |
| 24 | 31 | } |
| 25 | 32 | |
| 26 | 33 | /** |
| 27 | 34 | * Get default active role |