Skip to main content

Template — account/dashboard.php

templates/account/dashboard.php

Subscriber account dashboard template, rendered by the [benecaster_account] shortcode. Two variables were added in feature/membership-launch-cleanup to support the “Why I support” message input.

Variables

Variables are extracted into the template scope by benecaster_get_template_part() before the file is included. All existing variables remain unchanged; the two new variables listed below are added by feature/membership-launch-cleanup.

New in feature/membership-launch-cleanup

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.

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 — new in feature/membership-launch-cleanup
        'supporter_wall_message'           // required — new in feature/membership-launch-cleanup
    )
);

If only the original 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 →