Case Study - Global Reach, Local Touch: The Role of GeoDNS in eCommerce Expansion

Configuration for DNS hosting of registered domains

With the Registered domains mode of our WHMCS module your customers will be able to manage the DNS zones of their registered domain names. When a domain name is successfully registered the customer will be checked, if the service, you will create in Step 1, is activated for him and if not the service will be activated for him automatically. After that the DNS zone of the domain will be created with the default records. All domains registered by your customer will be shown in this Service. If there is no DNS zone for a particular domain name, it will be automatically created when the customer tries to manage it for the very first time.

Configuring a (free) product for DNS management of registered domains:

1. Create new Product/Service for DNS hosting and from the Module Settings tab choose ClouDNS DNS Manager as Module name. Remember the ID of the product, you will need it in Step 3.

2. Tick the Registered Domains checkbox, this will allow only registered domains in your system to have DNS zones in this service and the limit will be the amount of registered domains the customer has.

3. Open /path/to/whmcs/modules/servers/cloudns/cloudns_core/configuration.php with a text editor and enter an admin username, who has WHMCS API access. The permissions for that can be granted to the group the admin is in from WHMCS admin panel > Setup > Staff Managament > Administrator Users / Administrator Roles.

// whmcs admin account username
public static $_admin = 'admin';

After that enter the ID of the product.

/**
 * id of the product created for Free DNS management
 * of registerred domains.
 * It will be automatically activated 1
 * time after a successfull domain registration.
 */
public static $_pid = 0;

Save the file.

4. Move the file /path/to/whmcs/modules/servers/cloudns/cloudns_core/hooks/cloudns.php to /path/to/whmcs/includes/hooks/cloudns.php. The file has the following content:

if (!defined("WHMCS")) {
    die("This file cannot be accessed directly");
}

function activateFreeDNSHosting ($vars) {
    include ROOTDIR.'/modules/servers/cloudns/cloudns_core/hooks/add-free-dns-to-domain.php';
}

add_hook('AfterRegistrarRegistration', 1, 'activateFreeDNSHosting');
add_hook('DomainTransferCompleted', 1, 'activateFreeDNSHosting');

5. In order for you customers to use DNS Failover for their registered domains you need to execute the below SQL query. It will add a new column to the `tbldomains` database table, which will allow the module to count the Failover checks they activate for their zones. Without this column and without enabling the Failover from the Module settings of the product they will not be able to activate DNS Failover checks. The query may fail if certain columns do not have default values. In order to fix this you can set up the value '1000-01-01' for these columns in the 'tbldomains' table.

ALTER TABLE `tbldomains` ADD `fo_checks` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `updated_at`;

That's it!


Last modified: 2022-10-28
Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more