Skip to main content

benecaster_donor_enrollment_label

Filter Free

Filters the mailing-list opt-in checkbox label shown on the donation form when a show has Offer mailing-list opt-in on donation form switched on. It labels all three widget styles on the page (the inline form’s checkbox, and the label the button and icon modals read), and the same label is returned as enrollment_label by GET /benecaster/v1/shows/{id}/listener-support/config for anything building its own form. Both pass the same arguments, so a single callback covers every donation surface.

Default label: ‘Add me to {show_title}‘s mailing list’. Falls back to ‘Add me to this show’s mailing list’ when the show title is empty.

Parameters

Name Type Default Description
$label string — The default checkbox label string
$show_id int — ID of the show whose donation form is rendering
$show_title string — Title of the show as plain text (not HTML-encoded); empty string when the show has no title

Returns: string

Examples

Override the opt-in label with a translatable string

add_filter( 'benecaster_donor_enrollment_label', function( string $label, int $show_id, string $show_title ): string {
    return sprintf(
        /* translators: %s: show title */
        __( 'Join the %s newsletter', 'my-plugin' ),
        $show_title ?: __( 'show', 'my-plugin' )
    );
}, 10, 3 );

Notes

Return plain text. Benecaster escapes the label where it prints it, so don't escape it yourself.

The filter fires regardless of whether the donor has checked the box. It controls the label text only — it does not gate whether the checkbox appears. To hide the checkbox entirely, disable the per-show toggle in Shows -> [show] -> Listener Support.

Affects

  • Listener Support Donation Form

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