Richárd Balogh Posted November 25, 2020 Share Posted November 25, 2020 Hi! I want to ask you for help with the next thing. The case of the .hu TLD has been mentioned several times here in the community, my question would be related to this. It is technically not possible for the registry to extend the domain for more than 1 year. We as registrars can record this, there is no problem with that, but here comes the problem. The API retrieves the expiration date from the registry, but overwrites the expiration date. Let's look at an example: We have a domain that expires on November 25, 2021. My client paid a 2 year fee, so next time he would expire on 25-11-2023. We will initiate the renewal, so the date of 25-11-2023 will be registered with the registry. When we search for the domain, or the customer opens the domain information, or when the domain sync runs, it automatically queries the registry for the date, which is not good because it does not match. So I thought of one, and I want to solve this problem temporarily with a hook solution. But for some reason the hook doesn't work. I’m doing this for the first time, so look out for me on my clumsiness. This is what the API looks like: add_hook ('DomainEdit', 1, function ($ vars) { $ userid = xx; $ domainid = yy; $ command = 'UpdateClientDomain'; $ postData = array ( 'domains' => 'yy', 'expirydate' => '2023-12-25', 'nextduedate' => '2023-12-25', ); $ adminUsername = 'admin'; // Optional for WHMCS 7.2 and later $ results = localAPI ($ command, $ postData, $ adminUsername); print_r ($ results); }); And for some reason it doesn't want to work. Can you please help me how it would be appropriate? So my goal is to automatically update the data to the above 2023 date when it is displayed in admin, or when the client opens it, or after cron. Can you help me with this? I hope you understand what I have described, thank you in advance for your help! Best regards: Richard 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 26, 2020 Share Posted November 26, 2020 three immediate thoughts... the DomainEdit hook point is only going to be triggered when you are manually editing a domain in the admin area - and if you're manually editing it, then you don't really need the hook (unless i'm missing something?) you shouldn't add the space between the variable and the $, e.g $ userid should be $userid using UpdateClientDomain, you can only pass one domain at a time, either by name or ID - so 'domains' should be 'domain' (if you're using the domain name) or 'domainid' (if using the domainID value). On 25/11/2020 at 12:59, Richárd Balogh said: So my goal is to automatically update the data to the above 2023 date when it is displayed in admin, or when the client opens it, or after cron. possibly a after cron hook would be better so that if runs after domain sync has occurred. I suppose if you weren't syncing next due dates to the expiry dates, then you could use a client hook to replace the expiry date with the NDD value for .hu domains. 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.