BuyupDeclineRepository
\Benecaster\Membership\BuyupDeclineRepository
Remembers that a subscriber said no to a buy-up they were offered for nothing. Three actions record a decline, and they are the same decision: unticking a free buy-up on the sign-up form, removing a free grant from the account page, and unticking one offered by a billing-period switch.
A decline stops the buy-up being given automatically: the backfill and the sign-up grant both skip a subscriber who has declined. It does not hide the buy-up. A billing-period switch onto a period that includes it offers it again, because choosing that period is a new decision. Only the subscriber clears a decline, by adding the buy-up back from their account page.
Stored as user meta, one key per show: benecaster_declined_buyups_{show_id}, holding the declined buy-up IDs.
Methods
| Method | Visibility | Since | Description |
|---|---|---|---|
static meta_key( int $show_id ): string |
Public | — | The user meta key for one show's declines. |
record( int $user_id, int $show_id, int $buyup_id ): void |
Public | — | Records that the subscriber declined this buy-up on this show. |
record_many( int $user_id, int $show_id, array $buyup_ids ): void |
Public | — | Records several declines in one write. |
clear( int $user_id, int $show_id, int $buyup_id ): void |
Public | — | Removes a decline. Called when the subscriber adds the buy-up back from their account page. |
has_declined( int $user_id, int $show_id, int $buyup_id ): bool |
Public | — | Whether the subscriber has declined this buy-up on this show. |
declined_for( int $user_id, int $show_id ): array |
Public | — | Every buy-up ID the subscriber has declined on this show. |
Constants
| Name | Value | Description |
|---|---|---|
META_PREFIX |
'benecaster_declined_buyups_' |