Jump to content

Disable Registrar Lock option for unsupported TLD


hostservice_71

Recommended Posts

Hi,

 

there's several extensions like the popular .nl where the registrar does not use the Registrar Lock option. Still, customers with those tld's (about 90% of our customer base) still see an option in their account to Lock. When they click they get an error and start sending in support tickets.

 

How do we disable the option for certain tld's?

Link to comment
Share on other sites

How do we disable the option for certain tld's?

you may need to use a combination of hooks and template edits to achieve this - as I believe the reglock page can be visited via the sidebar, manage domain and bulk changes. :roll:

 

to remove the Registrar Lock link from the sidebar for specific TLDs, you could use the following hook...

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar)

{
$domain = Menu::context('domain');
$mydomain = $domain->domain;
$tld = substr($mydomain, strrpos($mydomain, ".")+1);
$blockedtlds = array('eu','nl');

if (in_array($tld, $blockedtlds)) {
   if (!is_null($primarySidebar->getChild('Domain Details Management'))) {
            $primarySidebar->getChild('Domain Details Management')
                           ->removeChild('Registrar Lock Status');
   }
}
});

in this case, .eu and .nl domains will not show the registrar lock link (regardless of whether it's available through the registrar module assigned to the TLD).

 

with regards to manage domain, you could add the following Smarty code to the beginning of clientareadomaindetails.tpl..

 

{$tld=substr($domain, strrpos($domain, ".")+1)}
{$blockedtlds=['eu','nl']}
{if in_array($tld,$blockedtlds)}
{$managementoptions.locking = false}
{/if}

this will remove the "Change the registrar lock status for your domain" link from the page for the specified TLDs... it's written in Smarty v3, so will only work in WHMCS v6+... you could make this into another hook (clientareapage) to avoid modifying the template, but for simplicity, i've used Smarty code. :idea:

 

to remove the bulk reglock option, just delete the link from clientareadomains.tpl...

 

<li><a href="#" id="reglock" class="setBulkAction"><i class="glyphicon glyphicon-lock"></i> {$LANG.domainreglockstatus}</a></li>

... or you could just edit the tabRegLock block of clientareadomaindetails.tpl and modify the text if the domain is from one of your specified TLDs. :)

Link to comment
Share on other sites

In case it helps someone ... here's how I ended up removing the Domain Lock option from the Domain Details page, using a hook:

 


add_hook('ClientAreaPageDomainDetails', 1, function ($vars) {
/* set unsupported TLDs and get current domain's TLD*/
$unsupportedTLDs = array(
	// domains that don't support locking
);
$domain          = Menu::context('domain');
$this_domain     = $domain->domain;
$tld             = substr($this_domain, strrpos($this_domain, ".") + 1);

/*----------  hide registrar lock options for unsupported TLDs  ----------*/
if (in_array($tld, $unsupportedTLDs)) {

	$vars['managementoptions']['locking']                 = false;
	$vars['lockstatus']                					  = false;

	return $vars;
}
});

Link to comment
Share on other sites

In what file do you do this?

any hooks will go in the includes/hooks directory - for the template edits, i've specified the file to edit.

 

Sorry it took little to respond. I'm flabbergasted this needs to be done in such a complicated way and is not just a simply tick box in admin option. Next to mail forwarding, DNS control and EPP code.

if you think the above is complicated, I dread to think what the module code to add this feature to the domain pricing would look like! :)

 

I guess you could make an addon to do that, but it would be easier for WHMCS to do it themselves... you could make a feature request for this, but I wouldn't hold your breath waiting for it to be implemented.

Link to comment
Share on other sites

  • 7 years later...
  • 6 months later...
  • 1 year later...

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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