benecaster_subscriber_wall_message
Fires after a subscriber’s “Why I support” message is saved via `SupporterWallManager::set_subscriber_message()`. The action fires after every write — including same-value writes and explicit clears (empty string). This mirrors the always-fires semantics of [benecaster_subscriber_wall_visible](/hooks/benecaster_subscriber_wall_visible/): if you want transition-only behavior, compare against `SupporterWallManager::get_subscriber_message()` before calling.
`$message` is the sanitized (`sanitize_textarea_field()`) and length-clamped (`mb_substr()`, max 240 characters) value that was actually persisted. An empty string means the subscriber explicitly cleared their message. The action fires regardless of whether the subscriber’s show has `_benecaster_show_supporter_wall_show_why_field` enabled — display gating is the shortcode’s responsibility.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID of the subscriber whose message was saved |
$message |
string |
— | The sanitized and length-clamped message that was persisted. Empty string = subscriber cleared their message. Maximum 240 characters (enforced by SupporterWallManager::MESSAGE_MAX_LENGTH). |
Examples
Moderate messages and auto-moderate flagged content
add_action( 'benecaster_subscriber_wall_message', function ( int $user_id, string $message ): void {
if ( empty( $message ) ) {
return; // subscriber cleared their message — nothing to moderate
}
if ( my_profanity_filter( $message ) ) {
// Blank the message and log for admin review.
( new \Benecaster\Membership\SupporterWallManager() )->set_subscriber_message( $user_id, '' );
my_audit_log( 'wall_message_flagged', [ 'user_id' => $user_id, 'original' => $message ] );
}
}, 10, 2 );