Skip to main content

benecaster_license_validated

Action Premium

Fires when the daily license validation cron receives a valid response from the Benecaster license server. This hook fires once per day under normal operating conditions, after the validation failure streak counter has been reset to zero.

“Valid” encompasses more than a clean active license — it includes grace period and expired statuses, as long as the server was reachable and returned a usable response. Use benecaster_license_invalid for explicit server-side rejections. Use this hook to refresh cached license data in add-ons or confirm daily connectivity. To react only when the plan changes, use benecaster_license_plan_changed, which does the comparison for you.

The daily run validates each connected show in turn, so the hook fires once for every connected show, and $show_uuid names the show this response is for. Pass it to benecaster_get_license_plan() when you read the cached license data back. A listener that takes only $response keeps working.

Parameters

Name Type Default Description
$response array — The response array from the license server, including `status` and `plan`
$show_uuid string — The `_benecaster_show_uuid` of the show that was validated

Examples

Refresh an add-on cache once per daily run

add_action( 'benecaster_license_validated', function( array $response, string $show_uuid ): void {
    // Fires once per connected show; act on the first one each day.
    $done_key = 'my_addon_license_refreshed_' . gmdate( 'Y-m-d' );
    if ( get_transient( $done_key ) ) {
        return;
    }
    delete_transient( 'my_addon_plan_features' );
    update_option( 'my_addon_cached_plan', benecaster_get_license_plan( $show_uuid ) );
    set_transient( $done_key, true, DAY_IN_SECONDS );
}, 10, 2 );

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