Extension Points
All public WordPress hooks provided by the middag-account plugin. Third-party plugins and satellites can use these to extend behavior without modifying core code.
Every hook uses the middag prefix. Domain events follow the pattern middag/{domain}/{event}.
Lifecycle Actions
| Hook | Parameters | Description |
|---|---|---|
middag_activated | none | Fired after plugin activation, CPTs registered |
middag_deactivated | none | Fired after plugin deactivation, cron cleared |
add_action('middag_activated', function (): void {
// Satellite plugin setup that depends on middag-account
});Domain Event Actions
Domain events are dispatched via do_action("middag/{domain}/{event}", ...$payload).
Entitlement Events
| Hook | Parameters |
|---|---|
middag/entitlement/created | EntitlementEntity $entitlement |
middag/entitlement/provisioned | EntitlementEntity $entitlement |
middag/entitlement/status_changed | EntitlementEntity $entitlement, string $old, string $new |
middag/entitlement/suspended | EntitlementEntity $entitlement, string $reason |
middag/entitlement/reactivated | EntitlementEntity $entitlement |
middag/entitlement/cancelled | EntitlementEntity $entitlement, string $reason |
add_action('middag/entitlement/provisioned', function (EntitlementEntity $ent): void {
if ($ent->class === 'PLG') {
// Auto-activate license for plugin entitlements
}
}, 10, 1);Quote Events
| Hook | Parameters |
|---|---|
middag/quote/created | QuoteEntity $quote |
middag/quote/accepted | QuoteEntity $quote |
middag/quote/rejected | QuoteEntity $quote |
middag/quote/paid | QuoteEntity $quote |
middag/quote/status_changed | QuoteEntity $quote, string $old, string $new |
The middag/quote/paid event triggers the auto-provisioning pipeline. QuoteEntitlementHooks listens at priority 10 to create entitlements from paid quotes.
Environment Events
| Hook | Parameters |
|---|---|
middag/environment/created | EnvironmentEntity $environment |
middag/environment/status_changed | EnvironmentEntity $environment, string $old, string $new |
Service Events
| Hook | Parameters |
|---|---|
middag/service/created | ServiceEntity $service |
middag/service/status_changed | ServiceEntity $service, string $old, string $new |
Ticket Events
| Hook | Parameters |
|---|---|
middag/ticket/created | TicketEntity $sr |
middag/ticket/status_changed | TicketEntity $sr, string $old, string $new |
Email Events
Dispatched through WordPressEventDispatcher and consumed by EmailEventListener:
| Event Name | Email Template |
|---|---|
auth.register_email_only | AuthRegisterEmailOnly |
auth.reset_password | AuthResetPassword |
auth.verify_account | AuthVerifyAccount |
auth.welcome | AuthWelcome |
collaborator.invite_sent | CollaboratorInvite |
collaborator.invite_accepted | CollaboratorAcceptedInvite |
collaborator.invite_rejected | CollaboratorRejectedInvite |
collaborator.permissions_updated | CollaboratorPermissionsUpdated |
collaborator.removed | CollaboratorRemoved |
WordPress hook name is middag/{eventName} (e.g., middag/auth.welcome).
Filter Hooks
middag_password_requirements
Override password validation rules (default follows NIST SP 800-63B):
add_filter('middag_password_requirements', function (array $req): array {
$req['min_length'] = 12;
return $req;
});Default: ['min_length' => 8, 'require_uppercase' => true, 'require_lowercase' => true, 'require_number' => true]
middag_rate_limit_whitelist
IPs exempt from API rate limiting. Default: ['127.0.0.1', '::1'].
add_filter('middag_rate_limit_whitelist', function (array $list): array {
$list[] = '10.0.0.1';
return $list;
});middag_email_event_map
Add or override event-to-email-template mappings:
add_filter('middag_email_event_map', function (array $map): array {
$map['order.completed'] = function (array $payload): void {
(new MyOrderEmail())->trigger($payload['email'], $payload['order_id']);
};
return $map;
});middag_email_print_button_color
Override CTA button color in service email templates. Default: WooCommerce base color.
middag_email_button_url
Override CTA button URL in "new site" email. Receives (string $url, array $cct).
Cron Hooks
Registered by CronRegistrar, cleared on deactivation:
| Hook Name | Interval | Description |
|---|---|---|
middag_every_minute | 60s | High-frequency background tasks |
middag_five_minutes | 5 min | Clock-aligned (e.g., :00, :05) |
middag_fifteen_minutes | 15 min | Medium-frequency sync |
middag_thirty_minutes | 30 min | Integration polling |
middag_hourly | 1 hour | Clock-aligned hourly tasks |
middag_twicedaily | 12 hours | Twice-daily maintenance |
middag_daily_morning | 24 hours | Daily at 06:00 server time |
Stability Contract
Existing hooks are never removed. New parameters are always appended to the end. This guarantee applies within the v1 lifecycle.