Home / Addons and Modules / Hooks Reference

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

HookWhen it firesParameters
admin_footerJust before the admin area footer HTMLNone
client_footerJust before the client area footer HTMLNone
public_footerJust before the public site footer HTMLNone

Use for: Injecting scripts, chat widgets, analytics, or custom HTML.

Action hooks – service

HookWhen it firesParameters
admin_service_view_contentWhen viewing a service in Admin → Services$service (array)
client_service_view_contentWhen viewing a service in Client Area → Services$service (array)
service_upgradeAfter 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

HookWhen it firesParameters
admin_domain_manage_sectionsWhen rendering domain manage page in Admin$domain, $registrar, $domainId, $currentInfo
client_domain_manage_sectionsWhen 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.).

HookWhen it firesParameters (array)
slack_order_createdNew order createdorder_id, client_id
slack_order_activatedOrder activated (services provisioned)order_id, client_id
slack_invoice_createdNew invoice created (checkout, manual, cron)invoice_id, client_id
slack_payment_receivedPayment recorded for an invoiceinvoice_id, client_id
slack_refund_processedRefund processedinvoice_id, client_id
slack_ticket_createdNew support ticket openedticket_id, client_id
slack_ticket_replyReply added to a ticketticket_id, reply_id
slack_ticket_noteStaff note added to a ticketticket_id, reply_id
slack_domain_registeredDomain registration completeddomain_id, domain
slack_service_suspendedService suspendedservice_id, client_id
slack_service_cancelledService cancelledservice_id, client_id
slack_provisioning_errorProvisioning failed (server/registrar error)service_id, client_id
slack_fraud_check_failedOrder rejected by fraud checkclient_id, error or action

Use for: Notifications, CRM sync, logging, webhooks to external systems.

Filter hooks

HookPurposeParametersReturn
admin_domain_manage_actionHandle custom domain actions in Admin$handled, $manageAction, $domain, $domainId, $registrartrue if you handled the action
client_domain_manage_actionHandle custom domain actions in Client Area$handled, $manageAction, $domain, $domainId, $registrar, $clienttrue 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 true to 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, return true if 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?

Tags: Developer