Skip to main content

benecaster_availability_unlocked

Action Premium

Fires when a tier gains access to a published episode. That needs two things, the episode published and the tier’s availability date passed, and the action fires on whichever happens second: the date passing on a published episode (the availability cron notices), or the episode being published or saved with the date already passed. On a save it runs at the end, after every availability date the save wrote, so it reads the new dates. It fires after the tier’s feed cache is cleared, either way. This is the “a tier can now hear this episode” event; the Email Editor’s new-episode emails hang off it.

Once per episode and tier, ever. Moving a date after it fired does not fire it again; clearing the tier’s date in the episode editor and setting it again does. A draft fires nothing. The unlock is recorded even while the license is not premium, so an unlock during a lapse is not replayed later as if it were new.

$available_datetime is the date that was set, and it can be long past. A back-dated episode, or an imported draft published months later, fires with an old date, so a listener announcing new episodes should compare it to the current time. Dates applied with Apply to selected in the import review table, and every date already passed when this behaviour arrived, are recorded as unlocked without firing, so a back catalogue is never announced.

Parameters

Name Type Default Description
$episode_id int — ID of the episode
$show_id int — ID of the parent show
$tier_slug string — Tier slug that gained access
$available_datetime int — Unix timestamp of the tier's availability date. Can be well before now on the publish path.

Need this built rather than just documented? See our services →