Skip to main content

Template — account/dashboard.php

templates/account/dashboard.php

Subscriber account dashboard template, rendered by the [benecaster_account] shortcode.

Variables

Variables are extracted into the template scope by benecaster_get_template_part() before the file is included.

Supporter Wall Message

Variable Type Notes
$supporter_wall_message_enabled bool true when at least one of the subscriber’s active-token shows has both _benecaster_show_supporter_wall_enabled and _benecaster_show_supporter_wall_show_why_field set to 1. Controls whether the message textarea block renders.
$supporter_wall_message string The subscriber’s current “Why I support” message. Pre-fills the textarea. Empty string when not set.

Both variables are defaulted at the top of the template file, so an override that has not been updated still renders without PHP notices — the message input silently does not appear.

Plan, Billing Period and Free Plan Sections

For built-in membership subscribers the template renders three sections between the Billing section (billing_portal) and the Extras section (buyups), in this order:

  • tier_switch (Your Plan) — the subscriber’s move to another tier, rendered by account/tier-switch.php
  • cadence_switch (Billing period) — the subscriber’s switch to another billing period of their tier, rendered by account/cadence-switch.php
  • free_switch (Free Plan) — a paying subscriber’s move to the show’s free plan, or a free member’s link to take out a paid plan, rendered by account/free-tier-switch.php

All three take the same $cadence value, so they always agree about what is pending: a subscriber has at most one pending change, and only the section that owns it shows the Cancel this change button. Each section is wrapped by its own hooks, which fire even when the section itself renders nothing:

Hook Fires Parameters
benecaster_before_account_tier_switch Before the plan section renders $show_id, $user_id
benecaster_after_account_tier_switch After the plan section renders $show_id, $user_id
benecaster_before_account_cadence_switch Before the billing-period section renders $show_id, $user_id
benecaster_after_account_cadence_switch After the billing-period section renders $show_id, $user_id
benecaster_before_account_free_switch Before the Free Plan section renders $show_id, $user_id
benecaster_after_account_free_switch After the Free Plan section renders $show_id, $user_id
Variable Type Notes
$cadence_by_show array Keyed by show ID. Each value is the description all three sections render from — current, options, tier_options, blocked, pending, free_option, pending_free, upgrade_url. Defaulted to [] at the top of the template, so an override that has not been updated renders without PHP notices.

An override of dashboard.php that lacks either block shows no section for it at all — not a broken one, an absent one — until you copy the tier_switch, cadence_switch and free_switch blocks from the current template into your override, in that order, between the billing_portal and buyups sections. There is nothing for an older override to fall back to.

Erase My Data Section

The last section on the page, after the Your data block. The template receives $erasure_request_html, already escaped, and prints it; erasure_request is in the all section list. An override of dashboard.php without the line simply has no such section. To change its wording, use benecaster_erasure_request_output rather than the template.

Email Preferences Section

The last section on each show card is email_preferences (Email preferences), after the QR code, rendered by account/email-preferences.php. It is always rendered, whatever the listener’s current opt-outs, because it is the only place they can undo one. It is wrapped by its own hooks:

Hook Fires Parameters
benecaster_before_account_email_preferences Before the Email preferences section renders $show_id, $user_id
benecaster_after_account_email_preferences After the Email preferences section renders $show_id, $user_id

benecaster_after_account_qr_code is no longer the last hook on a show card. To add your own section at the end of the card, use benecaster_after_account_email_preferences.

Variable Type Notes
$email_prefs_by_show array Keyed by show ID. Each value has one boolean per opt-out level (broadcast, episode_notifications, all), true when the listener has opted out at it. Passed to account/email-preferences.php as $email_opted_out. Defaulted to [] at the top of the template.

An override of dashboard.php without the email_preferences block has no Email preferences section, so its listeners cannot turn email back on from the account page. Copy the block from the current template into your override, after the qr_code section. An override of account/email-preferences.php should keep building its topic checkboxes from the levels Benecaster supplies rather than a hard-coded list, or it will stop offering a level added later.

Follower vs. Subscriber Classification

For each subscription, the template computes $token_type from $sub['token_type'] ('subscriber' by default, 'follower' when the key is 'follower') and derives $tier_display from it: the subscriber’s tier name, or “Follower” when $token_type is 'follower' — replacing the prior behaviour of printing the follower feed slug as if it were a tier.

The .benecaster-account__subscription wrapper div gains an is-follower / is-subscriber class and a matching data-token-type attribute, computed the same way.

Variable Type Notes
$sub['token_type'] string Key on each subscription array. 'subscriber' or 'follower'.

Theme Override Path

{theme}/benecaster/account/dashboard.php

See template-overrides for the full override directory convention and lookup order.

Note for Override Authors

account/dashboard.php passes variables into account/avatar via compact(). Overrides that forward variables into account/avatar must also include supporter_wall_message_enabled and supporter_wall_message in the compact() call, or the message input will silently not appear in the avatar template:

// In your overridden dashboard.php, when including account/avatar:
benecaster_get_template_part(
    'account/avatar',
    compact(
        'user_id',
        'avatar_url',
        'supporter_wall_enabled',
        'supporter_wall_visible',
        'supporter_wall_message_enabled',  // required
        'supporter_wall_message'           // required
    )
);

If only the other four variables are forwarded, account/avatar.php falls back to its own defaults — $supporter_wall_message_enabled becomes false and the message textarea is suppressed. No error is raised; the feature just does not appear.

See Also

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