benecaster_marketing_consent_label
Return a checkbox label to ask for marketing consent on a show; leave it null and no checkbox is shown. Benecaster asks only when an add-on asks it to, and never sends marketing email itself.
The checkbox appears, unticked, on Benecaster’s own forms only: the [benecaster_subscribe] checkout (free and paid tiers, logged in or not) and [benecaster_follower_signup]. A membership plugin’s own checkout is out of reach, so an add-on decides those shows’ opt-in itself. The label is shown as plain text — HTML is stripped — and stored verbatim with the answer as the text the person agreed to.
The answer is stored per person per show. Read it with benecaster_get_marketing_consent() and hear it change with benecaster_marketing_consent_changed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$label |
string|null |
— | Default `null` — no checkbox. |
$show_id |
int |
— | ID of the show the form is for |
Returns:
string|null
Examples
Ask only on shows where your add-on is switched on
add_filter( 'benecaster_marketing_consent_label', function ( ?string $label, int $show_id ): ?string {
if ( ! benecaster_addon_is_active( 'benecaster-addon-email-marketing', $show_id ) ) {
return $label;
}
return __( 'Email me about new episodes and offers from this show.', 'my-addon' );
}, 10, 2 );
Notes
One checkbox per show, however many add-ons ask. The last non-empty value wins, so return an existing $label unchanged unless your add-on owns the question, and return it unchanged for any show your add-on is not active on. An empty string counts as null. Worked example: the recipe Ask for marketing consent on Benecaster's own forms.
Affects
- benecaster_subscribe shortcode
- benecaster_follower_signup shortcode
Need this built rather than just documented? See our services →