Domain Profile Hooks
Saved contact profiles, default name servers and the renewal invoice — the last eight hooks of the domain area.
Overview
Most hooks here belong to an account rather than to one domain. Contact profiles and default name servers are templates a customer fills once and uses on every name.
The last two sit on the money side: where a customer renews a domain by hand, a gate stands in front of the invoice and an event behind it.
Reference
Following a profile delete
Runs after a saved contact profile was deleted.
id, name, information, detouse. Take what you need from here; the record is gone.Hook::add('action:domain.whois_profile_deleted', 10,
function ($uid, $profileId, $profile) {
// The record is gone: everything you need is in the third parameter.
Acme::dropProfileIndex($uid, $profileId);
});Following the default profile
Runs after a profile was made the default.
Hook::add('action:domain.whois_profile_default_set', 10,
function ($uid, $profileId, $profile) {
// The new default is the SECOND parameter; the third is the old record.
Acme::defaultProfile($uid, $profileId);
});Changing the profile form
Runs before a saved profile is loaded into the form.
id, name, first, last, org, email, phone, address, postal, city, country. Keep the key names; the form fills by them.Hook::add('filter:domain.whois_profile_data', 10,
function (&$data, $profile, $uid) {
// A field the form leaves out sits in the raw record: take it from there.
$data['state'] = $profile['information']['State'] ?? '';
});Following the default name servers
Runs after the customer's default name server set was saved. The set belongs to the whole account, not to one name.
ns1 … ns4 keys, filled ones only. At least two are present.Hook::add('action:domain.default_ns_saved', 10, function ($uid, $ns) {
// This set applies to EVERY new name on the account, not to one.
Acme::rememberDefaults($uid, $ns);
});Following provider settings
Runs after a domain provider's settings were saved.
Hook::add('action:domain.registrar_settings_saved', 10, function ($module, $settings) {
// Record that they changed, never what is inside them.
Audit::note('registrar-settings', $module, 'updated');
});Stopping a renewal invoice
Runs where a customer starts a manual renewal, before the invoice is raised. Stopping it means no invoice and no line is created.
Hook::add('gate:domain.renewal_invoice_create', 10,
function ($service, $years, $subtotal, $tld, $uid) {
// Some extensions take no renewal longer than ten years.
if ($years > 10) return 'Renewals run to ten years at most.';
return null;
});Following a renewal invoice
Runs after the renewal invoice was raised. The invoice is unpaid here and the domain is not renewed yet.
Hook::add('action:domain.renewal_invoice_created', 10,
function ($service, $years, $invoiceId, $subtotal, $duedateFull) {
// The domain is NOT renewed yet; that follows the payment.
Crm::pendingRenewal($invoiceId, $service['name'] ?? '', $years);
});Following DNS records that were read
Runs after the DNS records came back from the provider.
Hook::add('action:domain.dns_records_fetched', 10, function ($service, $records) {
Acme::snapshotZone((int) ($service['id'] ?? 0), $records);
});Following the detail page opening
Runs when a customer opens the management page of their own domain. Access checks are already behind you: the opener is confirmed as the owner.
id, name, owner_id, status, duedate and the rest.Hook::add('action:domain.detail.viewed', 10, function ($service, $serviceId) {
// Keep it light: the customer is waiting for the page.
Acme::touchLastSeen($serviceId);
});Pitfalls
On the default hook the third parameter is the profile record from before the change: its default field still holds the old value. Which profile is now the default is the second parameter. Reading the record and concluding "this one is not the default" comes from here.
Profiles and default name servers are account-wide templates. The hooks hand you an account id rather than a service record, so a listener reaching for domain details finds nothing. A sub-user's action is recorded against the owner.
The date field on the renewal invoice hook is the domain's current due date, not the one after renewing. The new date exists only once the payment lands. Using this one as "the new end" shows the customer the wrong day.
The settings hook can hand you the keys and passwords used to reach the provider. Recording that they changed is fair; recording what is in them is not. Log which module was updated and nothing more.
Related Articles
- Domain Contact Hooks
- Invoice and Payment Hooks
- Domain Hooks
Thanks for your feedback!
Our support team is here around the clock for anything you can't find above.