Skip to main content

SupporterWallManager

\Benecaster\SupporterWall\SupporterWallManager

Class Free

Manages the per-subscriber opt-in flag and “Why I support” message for the Supporter Wall. Third-party callers should use this class rather than reading the underlying user meta directly — method signatures are considered stable API.

Methods

Method Visibility Since Description
is_subscriber_visible( int $user_id ): bool Public — Returns true when the subscriber has opted in to appear on the Supporter Wall. Returns false when the meta is missing or '0'.
set_subscriber_visible( int $user_id, bool $visible ): bool Public — Writes the opt-in flag and fires benecaster_subscriber_wall_visible. Fires on every call including same-value writes. Returns true on success.
get_subscriber_message( int $user_id ): string Public — Returns the subscriber's 'Why I support' message from _benecaster_subscriber_wall_message user meta. Returns empty string when not set.
set_subscriber_message( int $user_id, string $message ): bool Public — Saves the message. Applies sanitize_textarea_field() and truncates to MESSAGE_MAX_LENGTH (240) via mb_substr(). Fires benecaster_subscriber_wall_message after every write. Returns false when $user_id <= 0.
is_supporter_wall_message_enabled_for_user( int $user_id ): bool Public — Returns true when at least one of the user's active-token shows has both _benecaster_show_supporter_wall_enabled and _benecaster_show_supporter_wall_show_why_field set to 1.

Constants

Name Value Description
META_KEY_SUBSCRIBER_VISIBLE '_benecaster_subscriber_wall_visible' WordPress user meta key for the opt-in flag ('1' = opted in, '0' or missing = opted out).
META_KEY_SUBSCRIBER_MESSAGE '_benecaster_subscriber_wall_message' WordPress user meta key where the subscriber's 'Why I support' message is stored.
MESSAGE_MAX_LENGTH 240 Maximum character length enforced by set_subscriber_message() via mb_substr().