Jump to content

Hide nameservers option in domain sign up


Recommended Posts

3 hours ago, spartanza said:

As the title says, I would like the ability to hide the "I will use my existing domain and update my nameservers" option on the domain sign up on specific services only

then it's going to be a variation on the hook I posted in the thread below...

<?php

/**
* Configure Domain Settings For Products
* @author brian!
*/

add_hook("ClientAreaPageCart",1,function($vars){

   global $productinfo;
   $validproducts = [1,2,3,4,5,45];

   if (in_array($productinfo['pid'],$validproducts)) {
       return array("owndomainenabled" => "");        
   }
});

$validproducts is an array of product IDs that you want to HIDE the existing domain option for - so all you should need to do is edit that array, and those products will not give the user the option of using their own domain during ordering. :idea:

Link to comment
Share on other sites

  • 5 years later...

This code  is using a ClientAreaFooterOutput hook to inject a JavaScript snippet into the footer of the client area pages.
This script hides all domain nameserver input fields by selecting elements with names starting with "domainns" and then hiding the closest parent element with the class "col-sm-4."

This is an effective approach to hide the domain nameserver input fields on the client area pages.
When the page loads, the script will run, and all the nameserver input fields will be hidden.

You will also need to edit the /lang/english.php file.
//$_LANG['domainnameservers'] = "Nameservers";
//$_LANG['cartnameserversdesc'] = "If you want to use custom nameservers then enter them below. By default, new domains will use our nameservers for hosting on our network.";

Please make sure to place this PHP code in a file for example.  remove_nameservers_code.php within the includes/hooks directory of your WHMCS installation.

<?php
add_hook('ClientAreaFooterOutput', 1, function() {
    return <<<HTML
    <script>
        $(document).ready(function() {
            // Hide all domain nameserver input fields
            $('[name^="domainns"]').closest('.col-sm-4').hide();
        });
    </script>
    HTML;
});

Edited by vb2cans
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated