Skip to main content

benecaster_manual_subscriber_created

Action Premium Since v1.0.0

Fires at the end of ManualSubscriberController::create(), after the manual-grant stamp has been written to benecaster_tokens (is_manual_grant = 1, and manual_expiry_at when an expiry was supplied). At this point the subscriber’s token is active and their welcome email has been dispatched.

Use this hook to tag the new user in an external CRM, post a Slack notification, log the grant to an audit system, or trigger any other side-effect that should run when an admin manually enrolls a subscriber. The $expiry_at parameter is a MySQL UTC DATETIME string (e.g. '2027-01-01 00:00:00') or null when the grant has no expiry — always guard against null before using it as a date string.

This action does not fire for paid signups or bulk-enrolled subscribers — only for grants created through the admin “Add subscriber manually” flow. For all subscription activations regardless of source, use benecaster_subscription_activated.

Parameters

Name Type Default Description
$user_id int WordPress user ID of the newly enrolled subscriber
$show_id int WordPress post ID of the show the subscriber was enrolled into
$tier_slug string Slug of the tier the subscriber was granted access to
$expiry_at string|null MySQL UTC DATETIME string (e.g. '2027-01-01 00:00:00') representing when access will be automatically revoked, or null if the grant has no expiry

Examples

Notify a Slack channel when a subscriber is manually added

add_action( 'benecaster_manual_subscriber_created', function(
    int     $user_id,
    int     $show_id,
    string  $tier_slug,
    ?string $expiry_at
): void {
    $user  = get_userdata( $user_id );
    $show  = get_the_title( $show_id );
    $expiry = $expiry_at ? " (expires {$expiry_at} UTC)" : '';

    my_slack_notify( "#memberships", "Admin manually added {$user->user_email} to {$show} on tier {$tier_slug}{$expiry}." );
}, 10, 4 );

Tag the subscriber in an external CRM

add_action( 'benecaster_manual_subscriber_created', function(
    int     $user_id,
    int     $show_id,
    string  $tier_slug,
    ?string $expiry_at
): void {
    $user = get_userdata( $user_id );
    my_crm()->tag_contact( $user->user_email, [ 'manual-grant', "tier:{$tier_slug}" ] );
}, 10, 4 );