Jump to content

Registrar lock only on supported extensions


glenn

Recommended Posts

Some domain extensions don't support "registrar locking". When a client tries to enable registrar lock on such domain name, he's greeted with following error message:

"An issue was encountered while updating the domain lock status. Please contact support."

I would prefer not to show the "registrar lock" option for such domain names. I don't think there is an option in WHMCS to do so. In the config domains page, we can only enable / disable DNS Management, Email Forwarding, ID Protection and EPP Code. 

If it's not possible to configure this directly in the WHMCS admin, would it be possible to implement the display of "registrar lock" through a hook?

Link to comment
Share on other sites

5 hours ago, glenn said:

"An issue was encountered while updating the domain lock status. Please contact support."

I know not the point of your post, but that error message could be changed using Language Overrides.

5 hours ago, glenn said:

I would prefer not to show the "registrar lock" option for such domain names. I don't think there is an option in WHMCS to do so. In the config domains page, we can only enable / disable DNS Management, Email Forwarding, ID Protection and EPP Code. 

I think it tends to be the registrar module that determines when the lock option is shown (or even if the feature is supported).

5 hours ago, glenn said:

If it's not possible to configure this directly in the WHMCS admin, would it be possible to implement the display of "registrar lock" through a hook?

I assume you mean the opposite, e.g to disable the display if the TLD is in an excluded list (or not in an included list) - though I think an excluded list would be shorter.

that sounds like a ClientAreaPageDomainDetails hook that takes the current domain, splits it into two to get the sld/tld separately and then checks that TLD against a list... if a match, then it falsifies $managementoptions.locking - that should prevent the normal link being shown to the user... additionally, you might need another hook to remove the sidebar option.

Link to comment
Share on other sites

On 3/11/2021 at 1:33 PM, brian! said:

I know not the point of your post, but that error message could be changed using Language Overrides.

That's probably how we are going to "fix" it indeed.

On 3/11/2021 at 1:33 PM, brian! said:

I think it tends to be the registrar module that determines when the lock option is shown (or even if the feature is supported).

Are you sure? I got the idea the option is ALWAYS shown, for each domain extension.

On 3/11/2021 at 1:33 PM, brian! said:

that sounds like a ClientAreaPageDomainDetails hook that takes the current domain, splits it into two to get the sld/tld separately and then checks that TLD against a list... if a match, then it falsifies $managementoptions.locking - that should prevent the normal link being shown to the user... additionally, you might need another hook to remove the sidebar option.

Thanks, but that sounds quite complicated for something which should be built-in in WHMCS 😞

I really hope WHMCS takes this into consideration as we've got quite a few clients contacting us about it.

Link to comment
Share on other sites

16 hours ago, glenn said:

Are you sure?

I wouldn't bet my life on it, but i'm fairly sure... 🙂

https://docs.whmcs.com/Domains_Management#Viewing.2FEditing_Locking_Status

Quote

Viewing/Editing Locking Status

Similarly, if the domain's registrar module supports domain locking and unlocking, a Registrar Lock field will appear along with the nameserver fields on the domains management page. Checking or unchecking the box and saving will submit that change to the domain registrar as well.

16 hours ago, glenn said:

I got the idea the option is ALWAYS shown, for each domain extension.

that's definitely not the case - for example, it isn't shown for .uk domains for me because the Nominet module doesn't support it... if a domain isn't assigned to any registrar, or the registrar it is assigned to doesn't support registrar locking, then I think the lock option will not be shown.

so your issue is that the registrar supports the locking feature, but is assuming that all TLDs are available for locking.

17 hours ago, glenn said:

Thanks, but that sounds quite complicated for something which should be built-in in WHMCS 😞

if only this had been posted about five years ago... 🙂

... which, if you update that hook for recent versions of WHMCS, becomes...

<?php

# Regitrar Lock Filter Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) {
	
	$domain = Menu::context('domain');
	$blockedtlds = array('eu','nl');
	if (in_array($domain->tld, $blockedtlds) && !is_null($primarySidebar->getChild('Domain Details Management'))) {
		$primarySidebar->getChild('Domain Details Management')->removeChild('Registrar Lock Status');
		function domain_registrar_lock_link_removal_hook($vars) {
			$managementoptions = $vars['managementoptions'];
			$managementoptions['locking'] = false;
			return array ("managementoptions" => $managementoptions);
		}
		add_hook("ClientAreaPageDomainDetails",1,"domain_registrar_lock_link_removal_hook");		
	}
});

this should, for the TLDs listed in the $blocktlds array, remove the two registrar locking links in the red boxes...

jd4NBGe.png

17 hours ago, glenn said:

I really hope WHMCS takes this into consideration as we've got quite a few clients contacting us about it.

you could die of old age waiting for WHMCS to do something. 👴

there is a feature request to add this option to domain pricing - 2 years, 18 votes... as with all FR, they could be added in the next release, or you could wait another 5 years and find that it's still not implemented.

Link to comment
Share on other sites

24 minutes ago, brian! said:

I wouldn't bet my life on it, but i'm fairly sure... 🙂

https://docs.whmcs.com/Domains_Management#Viewing.2FEditing_Locking_Status

I'm using the Domainbox registrar module, but it hasn't been updated since quite some time. So maybe they didn't implement the locking status in the module.

26 minutes ago, brian! said:

... which, if you update that hook for recent versions of WHMCS, becomes...

Oooh nice, that seems do to the trick indeed. The only thing still being shown is the following warning for such domains:

Domain Currently Unlocked!
You should enable the registrar lock unless you are transferring the domain.

Any chance to disable this as well in the hook?

 

Link to comment
Share on other sites

1 hour ago, glenn said:

The only thing still being shown is the following warning for such domains:

Domain Currently Unlocked!
You should enable the registrar lock unless you are transferring the domain.

Any chance to disable this as well in the hook?

that output is defined in the template based on the value of $lockstatus -  the tweaked hook below (it's just returning a value for $lockstatus) should prevent it from showing...

<?php

# Regitrar Lock Filter Hook
# Written by brian!

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function(MenuItem $primarySidebar) {
	
	$domain = Menu::context('domain');
	$blockedtlds = array('eu','nl');
	if (in_array($domain->tld, $blockedtlds) && !is_null($primarySidebar->getChild('Domain Details Management'))) {
		$primarySidebar->getChild('Domain Details Management')->removeChild('Registrar Lock Status');
		function domain_registrar_lock_link_removal_hook($vars) {
			$managementoptions = $vars['managementoptions'];
			$managementoptions['locking'] = false;
			return array ("managementoptions" => $managementoptions, "lockstatus" => "locked");
		}
		add_hook("ClientAreaPageDomainDetails",1,"domain_registrar_lock_link_removal_hook");		
	}
});
Link to comment
Share on other sites

17 hours ago, brian! said:

that output is defined in the template based on the value of $lockstatus -  the tweaked hook below (it's just returning a value for $lockstatus) should prevent it from showing...

Thanks man, working perfectly!

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.

  • 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