Multiple Free Domains (WHMCS)

From Deploymentcode
Jump to: navigation, search


You can order the module here


More than 1 free domain with a webhosting product is very common, specially in europe.

With this module you can offer your customers several free domains per product. With the ACL groups you can determine exactly which domain functions the customer has access to.
The amount of free domains can be set per product and differently per payment cycle to make prepayments more attractive. In addition, the amount of free domains and the allowed domain extensions can be setted for every client product individually.
This way you can provide free domains to products which normally does not have a free domain included.

The activated domains can be automatically added by the system into hosting account as addon domain (cpanel supported, plesk support coming).
The module is a drop-in addon which requires no modification of the WHMCS core settings.

It does also solve the renewal problem of free domains. WHMCS requires that the free domain has the same expire date as the client product. But this is often not possible if the domain has been transferred to you.
The module does not care about the expire date and will always ensure, that the domain renewal is handled correctly.

Existing free domains can be imported by the module.


Multiple Free Domains for WHMCS provides a wide range of features and customisation. Using the settings page, you can make changes to notifications, automation settings and client area settings.

Client Features

  • Activate additional free Domains (registrate, transfer)
  • View activated domains
  • Sidebar menu element at the product detail page
  • Automatically add activated domain to hosting account as addon domain (cPanel supported)

Admin Features

  • View / Remove activated domains
  • Set amount of free domains per package and per billing cycle
  • Set amount of free domains & allowed TLDs per client service
  • ACL System - permit or deny access to: WHMCS DNS Management, Nameserver Management, Mail Forwards, Get EPP Code, Autorenewal Setting, Domain Addonpage, Registrar Lock, Contact Details
  • ACL Groups can be setted per domain
  • Default ACL Group which will be automatically applied on new activations
  • ACL Groups are compatible with third party domain management modules More Informations
  • Admin Notifications on events (can be disabled)
  • Discard invoice mails for free domains (can be disabled)
  • Send Mail to client when a product with free domains gets suspended / unsuspended / terminated (can be disabled)
  • Free domain import which can be executed on module activation to import all existing free domains
  • Developers can add own modules to add activated domains to the hosting panel More Informations
  • Multi Language
  • PHP 5 / 7 supported
  • WHMCS v6 and v7 supported


Installation of the module can be completed within a short time.

Install the addon module

1. Download the module archive from the client area and extract it.
2. Upload the module to your WHMCS installation.
3. Go to the WHMCS Admin backend, click on "Setup" -> "Addon Modules".
4. Click "Activate" at Multiple Free Domains.
5. Click "Configure", enter your License Key and select "Full Administrator" at Access Control.
7. Click "Addons" => "Multiple Free Domains" to open the Addon Page.

Template Changes (optional)

The module does create additional smarty variables which can be useful to show informations to your clients.
All Template changes are optional.

Domain Configuration Page

In order to inform the customer immediately during the ordering process that he can activate additional domains in the product detail page, the following information can be displayed.
Order process showadditional.png

To show this informations, you need to add the following code into the file /templates/orderforms/standard_cart/configureproductdomain.tpl. Replace "standard_cart" with your shopping cart template.

{if $AdditionalFreeDomainsPossible}
     <div class='alert alert-success'>{$AdditionalFreeDomainsPossible}</div>

The file should look like here:
Shoppingcart code1.png

The information will be only shown if the product has free domains.
You can edit the text in the module language file.

Show amount of free domains per billing cycle

The amount of free domains per billing cycle can be shown during ordering.
Order additional domains.png

Open the file /templates/orderforms/standard_cart/configureproduct.tpl and search for the payment cycle output. It begins on line 55.
Replace "{$pricing.monthly}" with "{$pricing.monthly|replace:"{$FreeDomainsString}":"{$AmountFreeDomains.monthly} $FreeDomainsString"}" and continue replacing for all other payment cycles.

The result should be as following:

Change From Change To
"{$pricing.monthly}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.monthly} $FreeDomainsString"}"
"{$pricing.quarterly}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.quarterly} $FreeDomainsString"}"
"{$pricing.semiannually}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.semiannually} $FreeDomainsString"}"
"{$pricing.annually}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.annually} $FreeDomainsString"}"
"{$pricing.biennially}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.biennially} $FreeDomainsString"}"
"{$pricing.triennially}" replace:"{$FreeDomainsString}":"{$AmountFreeDomains.triennially} $FreeDomainsString"}"

The billing cycle text will be only adjusted, if free domains are available.
You can modify the text at the language file.

Cancellation Request Page

When a client want to cancel his product, you can show additional informations about his free domains.
If the product has free domains, the smarty variable "FreeDomains" is available. This variable contains an array with all domain IDs and domain names related to this product.

Here is the code of our example. The code must be added into /templates/six/clientareacancelrequest.tpl. Adjust it how you need.

{if $FreeDomains}
    <div class="panel panel-warning">
        <div class="panel-heading">
            <h3 class="panel-title">{$LANG.cancel_hosting_inclusivdomains_head}</h3>
        <div class="panel-body">
                {foreach item=domains from=$FreeDomains}
                    <li><a href="clientarea.php?action=domaindetails&id={$domains.domainid}" target="_blank">{$domains.domain}</a></li>

Notifications at Suspension / Unsuspension

The module is able to send you a admin ticket if a service, which has one or more free domains, get suspended / unsuspended or terminated. You can activate this setting at the menu "Module Settings".
Notification setting.png

ACL Groups

New ACL (Access Control List) Groups can be created under the tab "ACL Groups" and assigned to specific domains on the "Home" page. With these options you can specify the permissions at the client area.
Example: You do not want that your client can get the transfer code for his free domains and he should not be able to change the nameservers. To configure this, change the setting "Nameservers" and "EPP Code" to "No".
The ACL Group of the domains can be changed at the tab "Home".

A default ACL group can be selected at the Module Setting page. This group will be applied to new free domain activations.

Acl group.png

Language Override

Directly editing the language files is not recommended. These files may be overwritten during module updates, resulting in a loss of any edits you had made.
Instead, it is recommended to use overrides. Overrides allow you to customise the default variables with your own values such that they will be preserved through the update process.

To create an override, copy the language file into the directory /modules/addons/addondomain/lang/override/ and edit the text you want to change. This file will be not overwritten on a module update.

Module Menus

Open the Module admin page to admister. Click on "Addons" => "Multiple Free Domains".

Menu: Home

The Home page gives you an overview of all activated free domains. On that page you can also adjust the ACL group or remove a free domain.
If you remove a free domain, the recurring price will be automatically adjusted to your current domain renewal price.

Menu: Manually Establish Link

On the page "Manually Establish Link" you can manually convert an existing domain to a free domain. Enter the related domain ID and client product ID to establish a relationship.

Menu: Custom Limits

On the page "Custom Limits" you can apply custom limits to individual client products. You can set the amount of free domains and also which TLDs you want to allow to registrate / transfer.
The client product must not have a regular free domain. You can also provide free domains for products which has normally no free domain.
Furthermore you can also set the amount of free domains to 0 for individual client products which normally have free domains included.
That feature can be useful for individual packages or to make your quote offer more attractive - e.g. a VPS offer with 1 free domain.

Menu: Product Settings

On the page "Product Settings" you can choose how many free domains you want to give per product and per billing cycle.
It is possible that you give your clients a different amount of free domains per billing cycle to make longer payment cycles more attractive.

Module Settings

The Multiple Free Domains module offers a wide range of settings to adapt to your workflow. The module settings are shown in the following screenshots:


Notifications & Automation

Activate DNS Management on link deletion

If you delete a free domain from a product at the module "Home" page, the DNS Management setting of the domain will get activated.
If your ACL group already allows access to the DNS Management, this setting will have no effect.

Activate Mail Forwarding on link deletion

If you delete a free domain from a product at the module "Home" page, the Mail Forwarding setting of the domain will get activated.
If your ACL group already allows access to the DNS Management, this setting will have no effect.


Set a Client ID which should be used for opening notification tickets. If you do not have a client which can be used for that, you need to create a new client. Only necessary if Ticket Notifications are enabled.

Admin Notifications on Suspension / Terminate

Creates an admin ticket if a product with free domain has been suspended or terminated. Useful to take note of free domain suspensions.

Admin Notifications on Unsuspension

Enabling this setting will globally disable automated setup for new orders. This setting overrides individual server settings at the "Server Management" tab.

On Product Suspend do

The module can handle free domain suspensions in 2 ways:
Change Domainstatus to "Cancelled" and set Status back to "Active" if product get unsuspended
If choose this option, the client can not manage this domain anymore. The domain will not get renewed at the expire date.

Leave domain as it is. Just disable auto renew (Default)
If choose this option, the client can continue manage his domain. But the domain will not get renewed at the expire date because auto renewal is off.
The specificated ACL group will be still applied.

Default ACL Group

When a free domain get activated, the following ACL group will be applied.
The ACL groups can be used to limit client's management options at the WHMCS domain product page.

Mail Configuration

Do not send order confirmation mails

Do not send order confirmation and invoice creation mail when client activate a new free domain.

Do not send invoice confirmation mail

Do not send invoice payment confirmation for free domains at new order or renewal.

Send mail to client on product unsuspension

Send the selected mail template to your client. The mail can include informations what happens with his domains.
If you do not want to send a mail, choose "Do not send Mail".

Send mail to client on product termination

Send the selected mail template to your client. The mail can include informations what happens with his domains.
If you do not want to send a mail, choose "Do not send Mail".

Send mail to client on product suspension

Send the selected mail template to your client. The mail can include informations what happens with his domains.
If you do not want to send a mail, choose "Do not send Mail".

Client Area

Do not show renewal button

Do not show domain renew button at free domains.

Disable Bulk Tools

Disable domain bulk tools for free domains on the domain overview page. Checkboxes will be locked.
The WHMCS bulk tools allow the client to make adjustments to serveral domains at once. This may conflict with your ACL settings.

Show "Free Domains" Sidebar at product page

Activates the Sidebar Menu at the product page. The Sidebar shows a list of the activated domains and a link to the free domain activation page.
The icons can be adjusted at the following 3 options.

Head Sidebar Icon

Specificate a Font Awesome or a Glyphicons for the headline of the sidebar menu. Default: fa-shopping-cart

Domain Link Icon

Specificate a Font Awesome or a Glyphicons for the listed domains.

Manage Link Icon

Specificate a Font Awesome or a Glyphicons for the "Manage" link.


Run Import

Clicking this link will try to find and import all existing free domains and assign the domain to the related product.

Resync Domain Settings

If you have done changes which affects the module, you can force a manual consistency check.

The following tasks will be executed:

  • Ensure that the correct client id is deposited in the module database
  • Ensure that domain privileges matches with the settings of the ACL group (DNS Management / Email Forwarding)
  • If you change the Free Domain setting at the WHMCS product configuration ("renew as normal" <=> "free renewal"), it will update the renewal pricing for the related domains.

This function is also automatically executed when the WHMCS cronjob gets executed and ensures the consistency of your system.

Informations for Developers

Domain Provisioning Module for Hosting Panels

Currently we do support only cPanel to automatically add the additional domain as addon domain. You can add your own module to support other hosting panels like DirectAdmin.
To create your own provisioning module, open the directory /modules/addons/addondomain/providers/ and create a directory which has the same name as the WHMCS module.
If you are using the WHMCS server module 'directadmin', create a directory named directadmin and create inside the file 'directadmin.php'.
Inside this file you must create the function addondomain_addDomain which will get executed when a client activates a new free domain and his hosting product which uses the defined server module.

Here is an example, File: /providers/directadmin/directadmin.php

function addondomain_addDomain ($ProductDetails, $Domain, $ServerDetails) {
    $daUser = $ServerDetails['username'];
    $daHost = $ServerDetails['hostname'];
    $daPassword = $ServerDetails['accesshash'];
    $HostingUsername = $ProductDetails['tblhosting']['username'];

    // $ProductDetails gives you all informations from tblhosting 
    // logActivity (json_encode($ProductDetails));
    // $ServerDetails gives you all WHMCS server informations
    // logActivity (json_encode($ServerDetails));


    // result = success or fail
    // log = api response
    return array('result' => $result, 'log' => $apiresponse);

The parameter $ServerDetails gives you the server details and $ProductDetails gives you an array with all relevant client product informations.
The return will be logged to the module activity log if you have the WHMCS module log activated.

ACL Groups Compatibility with Third Party Addons

In the file /modules/addons/addondomain/ACLMenus.php you can define exactly which ACL setting affect which menus or requests.

An example use case:
You are using a third party DNS management module which does not depend on the "DNS Management" setting from the whmcs admin domain page. But you do not want to show this option at free domains because clients should use the webspace for setting DNS records.
Lets see the current restriction array:

"dns" => array(
        "Menu" => array(
                "Domain Forwarding",
                "Manage Private Nameservers",
                "Manage DNS Host Records",
                "dns management",
        "Request" => array(

In our example, your third party DNS management module is named "bestdnsmanagement", so we expend the array like here:

"dns" => array(
        "Menu" => array(
                "Domain Forwarding",
                "Manage Private Nameservers",
                "Manage DNS Host Records",
                "dns management",
        "Request" => array(
	"Fragment" => array(

At the array "Menu" write the menu name. Fragment is optional and defines the HTML fragment (#tabBestdnsmanagement) which will be unaccessable for direct access.
Some users with advanced IT knowledge may try to bypass the ACL filter with spoofed or manipulated requests, this is why the filtering works on 3 levels.
More comments about this function can be found inside of the file.

Technical Details

Name Multiple Free Domains for WHMCS
Last Update 11.11.2017
Compatible WHMCS v6, v7
Compatible PHP PHP 5, PHP 7
Licensing One license covers one WHMCS Installation
Code encryption ionCube
Orderlink Click