dewdropz Posted August 29, 2022 Share Posted August 29, 2022 Is that possible setting default DNS for each domain registrar? Any module or anything else? 0 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted August 29, 2022 Share Posted August 29, 2022 By DNS do you mean nameservers? 0 Quote Link to comment Share on other sites More sharing options...
dewdropz Posted August 30, 2022 Author Share Posted August 30, 2022 Yes, dns means nameserver 0 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted August 30, 2022 Share Posted August 30, 2022 14 hours ago, dewdropz said: Yes, dns means nameserver DNS could relate to the records also for a domain. Do you want this to happen when the client signs up for the first time? 0 Quote Link to comment Share on other sites More sharing options...
dewdropz Posted August 31, 2022 Author Share Posted August 31, 2022 When anyone order domain. 0 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted August 31, 2022 Share Posted August 31, 2022 Heya dewdropz, You could use the PreDomainRegister hook to change the nameservers associated with the domain based on an array before its registered e.g. $registrars = [ 'ResellerClub' => [ 'ns1' => 'ns1.domain.tld', 'ns2' => 'ns2.domain.tld', 'ns3' => 'ns3.domain.tld', 'ns4' => 'ns4.domain.tld' ] ]; If you need me to write a hook, just let me know what Registrars and nameservers you need, can PM me in private if you wish. 0 Quote Link to comment Share on other sites More sharing options...
dewdropz Posted September 12, 2022 Author Share Posted September 12, 2022 Thanks a lot. Register Epik and connectreseller Please make a hook from Epik and connectreseller register and tell me where I will input it. 0 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted September 13, 2022 Share Posted September 13, 2022 Hi dewdropz, I'll put one together for you later. 0 Quote Link to comment Share on other sites More sharing options...
leemahoney3 Posted September 13, 2022 Share Posted September 13, 2022 (edited) Hi dewdropz, So I don't have the modules for Epik or ConnectReseller, however you just need to amend the values in the arrays below. Create a file in your /includes/hooks/ folder and paste the following code: <?php use WHMCS\Database\Capsule; if (!defined('WHMCS')) { die('You cannot access this file directly.'); } function pre_register_nameservers($vars) { $registrars = [ 'resellerclub' => [ 'ns1' => 'ns1.test.com', 'ns2' => 'ns2.test.com', 'ns3' => '', 'ns4' => '', ], 'connectreseller' => [ 'ns1' => 'ns3.test.com', 'ns2' => 'ns4.test.com', ], 'epik' => [ 'ns1' => 'ns5.test.com', 'ns2' => 'ns6.test.com', 'ns3' => 'ns7.test.com', ], ]; /* ------------------------------------------------- */ /* ONLY EDIT VARIABLES ABOVE THIS LINE */ /* ------------------------------------------------- */ $domain = $vars['params']['domain']; $domainDetails = Capsule::table('tbldomains')->where('domain', $domain)->first(); foreach ($registrars as $registrar => $nameservers) { if ($domainDetails->registrar != $registrar) { continue; } if (empty($nameservers)) { continue; } $nameservers = array_reverse($nameservers); $nameservers['domainid'] = $domainDetails->id; $command = localAPI('DomainUpdateNameservers', array_reverse($nameservers)); if ($command['result'] == 'error') { logActivity("Automatic nameserver assignment failed for {$domain} with error: {$command['error']}", $domainDetails->userid); } } } add_hook('AfterRegistrarRegistration', 1, 'pre_register_nameservers'); Edit the nameserver arrays as required, you don't need to include all nameservers, just the ones you wish to update. (Though I'd suggest defining them all and leaving the ones that are not needed blank) I've left in resellerclub as an example, you will need to update the names for epik and connectreseller if they are not correct. I don't have the modules so am unsure what they are called. However if you look up the tbldomains database table, the correct names will be listed under the registrar column. You will obviously need to update the nameservers also, I've just left them in as an example. Edited September 13, 2022 by leemahoney3 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.