Hooks Reference
Complete list of all action and filter hooks
What it is
This document lists every hook available in WHMDC. Use it to know when to run your code and what data you receive. All hooks are registered in your addon's hooks.php using HookManager::addAction() or HookManager::addFilter().
Action hooks – layout
| Hook | When it fires | Parameters |
|---|---|---|
admin_footer | Just before the admin area footer HTML | None |
client_footer | Just before the client area footer HTML | None |
public_footer | Just before the public site footer HTML | None |
Use for: Injecting scripts, chat widgets, analytics, or custom HTML.
Action hooks – service
| Hook | When it fires | Parameters |
|---|---|---|
admin_service_view_content | When viewing a service in Admin → Services | $service (array) |
client_service_view_content | When viewing a service in Client Area → Services | $service (array) |
service_upgrade | After a service upgrade completes | $data: service_id, from_product_id, to_product_id, upgrade_type, from_module, to_module |
Use for: Adding custom sections to service view pages, reacting to upgrades (e.g. license sync).
Action hooks – domain
| Hook | When it fires | Parameters |
|---|---|---|
admin_domain_manage_sections | When rendering domain manage page in Admin | $domain, $registrar, $domainId, $currentInfo |
client_domain_manage_sections | When rendering domain manage page in Client Area | $domain, $registrar, $domainId, $client, $currentInfo |
Use for: Adding custom sections (e.g. DNS management, email forwarding) to the domain manage page. Output HTML for your section.
Action hooks – notifications (slack_*)
These hooks fire when events occur. The name prefix slack_ is historical; you can use them for any integration (Slack, Discord, CRM, webhooks, etc.).
| Hook | When it fires | Parameters (array) |
|---|---|---|
slack_order_created | New order created | order_id, client_id |
slack_order_activated | Order activated (services provisioned) | order_id, client_id |
slack_invoice_created | New invoice created (checkout, manual, cron) | invoice_id, client_id |
slack_payment_received | Payment recorded for an invoice | invoice_id, client_id |
slack_refund_processed | Refund processed | invoice_id, client_id |
slack_ticket_created | New support ticket opened | ticket_id, client_id |
slack_ticket_reply | Reply added to a ticket | ticket_id, reply_id |
slack_ticket_note | Staff note added to a ticket | ticket_id, reply_id |
slack_domain_registered | Domain registration completed | domain_id, domain |
slack_service_suspended | Service suspended | service_id, client_id |
slack_service_cancelled | Service cancelled | service_id, client_id |
slack_provisioning_error | Provisioning failed (server/registrar error) | service_id, client_id |
slack_fraud_check_failed | Order rejected by fraud check | client_id, error or action |
Use for: Notifications, CRM sync, logging, webhooks to external systems.
Filter hooks
| Hook | Purpose | Parameters | Return |
|---|---|---|---|
admin_domain_manage_action | Handle custom domain actions in Admin | $handled, $manageAction, $domain, $domainId, $registrar | true if you handled the action |
client_domain_manage_action | Handle custom domain actions in Client Area | $handled, $manageAction, $domain, $domainId, $registrar, $client | true if you handled the action |
Use for: Adding custom domain manage actions (e.g. DNS records, email forwarding). When the user submits a form with your manageAction value, your filter runs. If you handle it, return true to prevent the default handler from running.
When hooks fire (before/after)
- Layout hooks (admin_footer, client_footer, public_footer): Fire after the main content, just before the closing HTML. You add output (scripts, HTML) here.
- Notification hooks (slack_*): Fire after the event completes (e.g. after invoice is created and saved). The action has already happened.
- Domain section hooks: Fire during page render. You output HTML that gets inserted into the page.
- Domain action filters: Fire before the default handler. Return
trueto cancel the default. - service_upgrade: Fires after the upgrade is committed to the database.
Performance and "do not do" notes
- Do not block: Avoid long-running operations in hooks. If you call an external API (Slack, CRM), consider queuing the work instead of blocking the request.
- Do not throw: Uncaught exceptions in hooks can break the page or flow. Wrap your logic in try/catch and log errors.
- Do not redirect in layout hooks: admin_footer, client_footer run after output may have started. Redirecting can cause "headers already sent" errors.
- Do not assume order: Multiple addons can hook the same event. Your callback may run before or after others (by priority). Do not depend on execution order.
- Filters must return: Filter callbacks must return the (possibly modified) value. For
client_domain_manage_action, returntrueif you handled the action, else return$handled.
Example: Notify on new invoice
HookManager::addAction('slack_invoice_created', function($data) {
$invoiceId = $data['invoice_id'] ?? 0;
$clientId = $data['client_id'] ?? 0;
// Fetch invoice details from DB, send to Slack/Discord/CRM
}, 10);
Example: Add DNS section to domain manage
HookManager::addAction('client_domain_manage_sections', function($domain, $registrar, $domainId, $client, $currentInfo) {
if ($registrar->getName() !== 'namesilo') return;
?><div class="card"><div class="card-header">DNS Records</div><div class="card-body">...</div></div><?php
}, 10);
Example: Handle custom domain action
HookManager::addFilter('client_domain_manage_action', function($handled, $manageAction, $domain, $domainId, $registrar, $client) {
if ($manageAction !== 'my_dns_update') return $handled;
// Process form, call registrar API, redirect
redirect('/client/domains/manage/' . urlencode($domain['domain']));
return true;
}, 10, 6); Was this helpful?