Clanbite Since 1.5.0

clanbite_register_message( string $key, array $args ): void

Register a customisable message.

A message is a short piece of wording the site owner may want to change: a notification title, a popup, the text of an automatic post. Register it with its default and the placeholders you will fill in, then build the text with clanbite_get_message() instead of a hard-coded __() string. Site owners edit it under the **Messages** sub-tab of the extension's settings tab (see clanbite_message_group_extensions()); an empty field keeps your default.

Call this on or after init (so __() already has its translations), or add the definition through the clanbite_message_definitions filter, which is evaluated lazily.

Parameters

$key (string) Required

Unique key, lowercase with an area prefix: team_invite.title. Letters, numbers, _ and one . between parts.

$args (array<string, mixed>) Required

Message definition.

  • $label string Required. Short name shown above the field.
  • $default string Required. Default wording, with {placeholder} tokens.
  • $group string Group slug from clanbite_message_groups(). Default general.
  • $description string Where the message appears (one sentence).
  • $placeholders array<string, string> Token name => what it contains, for the placeholders $default may use.
  • $multiline bool Use a multi-line field (default false).

Returns

void

Defined in inc/messages.php

Changelog

VersionDescription
1.5.0Introduced.