Jump to content

Domain marked as "active" even if registration is not successfull...


Walther

Recommended Posts

I met following issue, using different registrar modules, so I guess it's an issue of WHMCS itself...

When a user register a domain, and the registration does not complete for any reason (insufficient funds, or some kind of error iduring registration, or whatever...) the domain is marked as "active".

This is misleading for the user ("Why my domain is active but it does not work?!?"), but also for us (having it marked in admin area as "pending" or "pending registration" would make everything easier...)

So I'm here to ask: any trick in order to mark a domain as "pending registration" whenever an error occurs during registration process?

Link to comment
Share on other sites

On 11/9/2021 at 10:00 PM, steven99 said:

Using the AfterRegistrarRegistrationFailed and similar hooks and setting the domain's status to pending via API would be your next step but that requires coding a hook 

Good idea.

It should be something like this:

add_hook('AfterRegistrarRegistrationFailed', 1, function($vars) {
  $command = 'UpdateClientDomain';
  $postData = array(
    'domainid' => $vars['domainid'];,
    'status' => 'Pending Registration',
   );
  $results = localAPI($command, $postData);
  logActivity('domain id '.$vars['domainid'].' set as Pending Registration');
}

(but this doesn't work... nothing is reported  in activity log, so I guess that the hook is not triggered... WHMCS docs about this hook is very poor, so it's difficult to understand if the triggering event is different, or if it's a WHMCS bug (it wouldn't be the first time that a hook point does not work...)

Link to comment
Share on other sites

15 hours ago, steven99 said:

You have a ";" hiding after $vars['domainid'];, in the postData array and so is likely silently erroring out. 

Nice shot!
It was not the only bug in my (too much quickly written) script.
Here the right code, that I tested and is working fine:

add_hook('AfterRegistrarRegistrationFailed', 1, function($vars) {
  $command = 'UpdateClientDomain';
  $domid = $vars['params']['domainid'];
  $postData = array(
    'domainid' => $domid,
    'status' => 'Pending',
   );
  $results = localAPI($command, $postData);
  logActivity('Domain id '.$domid.' - '.$vars['params']['sld'].'.'.$vars['params']['tld'].' set as Pending Registration');
});

 

Link to comment
Share on other sites

I would put the command and array directly in the localAPI to save on lines and would add in the results of the update just in case something funky is going on. 

  logActivity('Domain id '.$domid.' - '.$vars['params']['sld'].'.'.$vars['params']['tld'].' set as Pending Registration: '.$results['result']);
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