Override registrar's DNS management

SoluteDNS for WHMCS v2.xx.xxx and lower
gorip96
Registered
Posts: 18
Joined: 29 Dec 2014, 10:03

28 Jan 2017, 19:59

I found this on activity log

Code: Select all

Hooks Debug: Hook Defined for Point: ClientAreaPrimarySidebar - Priority: 1 - Function Name: (anonymous function)


I don't know whether it's related, because I can't find which module is calling that hook function
User avatar
Daniel
Support
Posts: 198
Joined: 02 Aug 2013, 17:50

28 Jan 2017, 20:46

The hook initiated by SoluteDNS should state an function name starting with SDNS_ and should reflect the priority as set in the custom_hooks.php file of SoluteDNS.

For example:

Code: Select all

Hooks Debug: Hook Defined for Point: ClientAreaPrimarySidebar - Priority: 99 - Function Name: SDNS_hook_menu


But you may see which hooks are loaded first using which priority based on the hooks debug log. Please note there may be other hook points as well which interact with the WHMCS menu system. Also see the WHMCS hooks documentation for more information about it.
gorip96
Registered
Posts: 18
Joined: 29 Dec 2014, 10:03

28 Jan 2017, 21:49

On my log file, I search for SDNS_hook_menu function, but Priority always shows as 1, even though I've configured different priority value in custom_hooks.php
User avatar
Daniel
Support
Posts: 198
Joined: 02 Aug 2013, 17:50

28 Jan 2017, 23:01

If the priority value is 1 in all cases the most likely explanation is the SDNS_hook function isn’t being detected which may be caused by

- Hook function name misspelled
- Hook filename misspelled
- Hook file in wrong directory
- The hook file isn’t opened with <?php

If the priority value is 0 and the hook is set the most likely explanation is the SDNS_hook isn’t returning any or incorrect values.
gorip96
Registered
Posts: 18
Joined: 29 Dec 2014, 10:03

29 Jan 2017, 04:28

Ah yes you're right, I forgot to add the <?php and ?> at the beginning and end of the file.
After adding it, it works now

Here's the current custom_hooks.php content

Code: Select all

<?php
function SDNS_hook_ClientAreaMenuPriority() {
        return array(
                'ClientAreaPrimarySidebar' => 65535,
                'ClientAreaPrimaryNavbar' => 1
        );
}
?>
gorip96
Registered
Posts: 18
Joined: 29 Dec 2014, 10:03

29 Jan 2017, 06:55

I have a suggestion

As I understands, the module's menu hook is activated, if the zone for the domain exists in the database.
Is it possible to add additional condition, where the menu hook is activated if the zone for the domain exists, AND the domain is pointed to Nameservers as configured in SoluteDNS's settings, at least the first nameserver, which matches the SOA
User avatar
Daniel
Support
Posts: 198
Joined: 02 Aug 2013, 17:50

29 Jan 2017, 14:14

Good to hear it's now working as expected.

The menu entry is related to the zone being index by SoluteDNS meaning it's in the solutedns zones table and assigned to an client. If it's not indexed, SoluteDNS will not overwrite the DNS Management sub menu entry. If an zone exists but you don't want to show the SoluteDNS entry you probably want to remove the index value.

If you want to make this dependent on record values within the zone you are required to make a connection with the remote nameserver database. This will slow down overall system performance and causes issues when for whatever reason the nameserver database connection times out/ is unable to connect.
gorip96
Registered
Posts: 18
Joined: 29 Dec 2014, 10:03

29 Jan 2017, 14:20

I'm not referring to the DNS record value. But the {$ns1} value in WHMCS
User avatar
Daniel
Support
Posts: 198
Joined: 02 Aug 2013, 17:50

29 Jan 2017, 18:49

Well the health system checks if the nameservers are set correctly at the registry. Currently there are no automated features depending on the health status but there is an feature request for auto deleting zones which don't have the correct nameservers at registry level.

For any custom menu entry processing you could create an own menu entry using the WHMCS hooks to overwrite the SoluteDNS one and point it accordingly to meet your conditions. If required to save some unnecessary rewriting you can disable the SoluteDNS menu entry in the SoluteDNS accessibility settings.
Post Reply