Skip to content

Domain

The following hooks are provided for Domain related events.

DomainDelete

Executes when a domain is being deleted from the client account.

Parameters

VariableTypeNotes
useridint
domainidint

Response

No response supported

Example Code

<?php
add_hook('DomainDelete', 1, function($vars) {
    // Perform hook code here...
});

DomainEdit

Executes when the domain is being edited via the Client Profile Summary and Domains tabs in the Admin Area.

Parameters

VariableTypeNotes
useridint
domainidint

Response

No response supported

Example Code

<?php
add_hook('DomainEdit', 1, function($vars) {
    // Perform hook code here...
});

DomainTransferCompleted

Executes when a domain transfer is set to completed by the domain sync cron.

Parameters

VariableTypeNotes
domainIdintThe unique identifier for the domain
domainstringThe domain name
registrationPeriodstringThe registration period
expiryDatestringThe expiry date (if returned by the registrar)
registrarstringThe registrar used

Response

No response supported

Example Code

<?php
add_hook('DomainTransferCompleted', 1, function($vars) {
    // Perform hook code here...
});

DomainTransferFailed

Executes when a domain transfer is set to failed by the domain sync cron.

Parameters

VariableTypeNotes
domainIdintThe unique identifier for the domain
domainstringThe domain name
registrationPeriodstringThe registration period
expiryDatestringThe expiry date (if returned by the registrar)
registrarstringThe registrar used

Response

No response supported

Example Code

<?php
add_hook('DomainTransferFailed', 1, function($vars) {
    // Perform hook code here...
});

DomainValidation

Executes as domain validation is being run

Parameters

VariableTypeNotes
sldstringThe sld of the domain. eg whmcs in whmcs.com
tldstringThe tld of the domain. eg com in whmcs.com

Response

No response supported

Example Code

<?php
add_hook('DomainValidation', 1, function($vars) {
    // Perform hook code here...
});

PreDomainRegister

Executes before a domain register command

Parameters

VariableTypeNotes
domainstringThe domain being registered

Response

No response supported

Example Code

<?php
add_hook('PreDomainRegister', 1, function($vars) {
    // Perform hook code here...
});

PreDomainTransfer

Executes before a domain transfer command

Parameters

VariableTypeNotes
paramsarrayCommon domain registrar parameters. See http://developers.whmcs.com/domain-registrars/module-parameters/

Response

No response supported

Example Code

<?php
add_hook('PreDomainTransfer', 1, function($vars) {
    // Perform hook code here...
});

PreRegistrarRegisterDomain

Executes prior to the registrar function being executed for a domain. Allows the action to be aborted.

Parameters

VariableTypeNotes
paramsarrayArray of common module parameters. See https://developers.whmcs.com/domain-registrars/module-parameters/

Response

Accepts an optional array return. Return abortWithSuccess=true to abort the action and treat it as successful. Return abortWithError=Error messages goes here to abort the action and treat it as failed.

Example Code

<?php
add_hook('PreRegistrarRegisterDomain', 1, function($vars)
    {
        $domainName = $vars['params']['sld'] . '.' . $vars['params']['tld'];

        return array(
            'abortWithError' => 'Error message to display goes here',
        );

        //return array(
        //    'abortWithSuccess' => true,
        //);
    }
);

PreRegistrarRenewDomain

Executes prior to the registrar function being executed for a domain. Allows the action to be aborted.

Parameters

VariableTypeNotes
paramsarrayArray of common module parameters. See https://developers.whmcs.com/domain-registrars/module-parameters/

Response

Accepts an optional array return. Return abortWithSuccess=true to abort the action and treat it as successful. Return abortWithError=Error messages goes here to abort the action and treat it as failed.

Example Code

<?php
add_hook('PreRegistrarRenewDomain', 1, function($vars) {
    // Perform hook code here...
});

PreRegistrarTransferDomain

Executes prior to the registrar function being executed for a domain. Allows the action to be aborted.

Parameters

VariableTypeNotes
paramsarrayArray of common module parameters. See https://developers.whmcs.com/domain-registrars/module-parameters/

Response

Accepts an optional array return. Return abortWithSuccess=true to abort the action and treat it as successful. Return abortWithError=Error messages goes here to abort the action and treat it as failed.

Example Code

<?php
add_hook('PreRegistrarTransferDomain', 1, function($vars) {
    // Perform hook code here...
});

TopLevelDomainAdd

Executes when a new domain extension is added.

Parameters

VariableTypeNotes
tldstring
supportsDnsManagementbool
supportsEmailForwardingbool
supportsIdProtectionbool
requiresEppCodebool
automaticRegistrarstring

Response

No response supported

Example Code

<?php
add_hook('TopLevelDomainAdd', 1, function($vars) {
    // Perform hook code here...
});

TopLevelDomainDelete

Executes when a domain extension is deleted.

Parameters

VariableTypeNotes
tldstring

Response

No response supported

Example Code

<?php
add_hook('TopLevelDomainDelete', 1, function($vars) {
    // Perform hook code here...
});

TopLevelDomainPricingUpdate

Executes when domain extension pricing is updated.

Parameters

VariableTypeNotes
tldstring

Response

No response supported

Example Code

<?php
add_hook('TopLevelDomainPricingUpdate', 1, function($vars) {
    // Perform hook code here...
});

TopLevelDomainUpdate

Executes when domain extensions configuration is updated.

Parameters

VariableTypeNotes
modifiedTldsstring[]An array of domain extensions that have been modified.

Response

No response supported

Example Code

<?php
add_hook('TopLevelDomainUpdate', 1, function($vars) {
    // Perform hook code here...
});