Jump to content

Custom DomainValidation checking


JGPVD

Recommended Posts

Hello,

 

For one kind of domain tld we need to add some custom Domain Validation checking on top / instead of standard WHMCS checking.

We created a hook "DomainValidation" in which we can call a 3rd party and check if the domain is really available (even if it is not visible in whois/dns) and can throw an exception with custom error message which is being displayed on top of domainchecker page.

 

But the problem is that the domain is still shown bellow as free and the customer can still order/pay for that.

 

Is there any way to:

#1 return the information from hook that domain is not available?

#2 prevent domainchecker-result.tpl from display that domain / make domainchecker-result.tpl to respect extra Template Variables?

(Allow Smarty PHP Tags is on but this template is being called before the hook or hook result array is not being passed)

#3 place this custom domain check elsewhere to achieve simmilar efect (precent customer from buying not free domain)?

 

We are developing a custom registrar module for one domain tld so might put additional checking in there. But it seems that during domain validation non of the Registrar Module funtions are being called, is that right?

 

Than you in advance for your help.

 

JG

Link to comment
Share on other sites

JG,

 

out of curiosity, which TLD is this ?

 

when you can do #1 (by returning the value (even boolean) back to the template as a Smarty variable), then you can do #2 by using that value in an {if} statement in domainchecker-results.tpl to hide the domain from the results (or whatever it is you want to do) - you won't need php tags in the template to do it.

Link to comment
Share on other sites

JG,

 

> out of curiosity, which TLD is this ?

 

.pl - there are a few domain states that do not publish anything to whois/DNS and a few that even if there is a whois entry still allow the domains to be registered.

Besides we want to use our own registrar's module and _pass_the inforamtion back to the user-interface.

 

>when you can do #1 (by returning the value (even boolean) back to the template

> as a Smarty variable),

 

We've tried this and it's not working (as expected).

Passing Smarty variable works only when you reload/refresh the whole page. When called by ajax- even if hook was executed - the variable from Smarty point of view is empty.

 

> then you can do #2 by using that value in an {if} statement in domainchecker-results.tpl

> to hide the domain from the results (or whatever it is you want to do) - you won't

> need php tags in the template to do it.

 

That is/was the plan. But please help with #1 :)

 

JG

Link to comment
Share on other sites

We updated the whmcs version to the newest one.

Added only those changes (following examples from your website)

 

hooks.php in registrars/modules/ourmodule/

<?php

add_hook( 'DomainValidation', 1, function( $vars)

{

//some extra logging in here to be sure the hook was called

 

$extraTemplateVariables = array();

// set a fixed value

$extraTemplateVariables['fixedValue'] = 'abc';

// return array of template variables to define

return $extraTemplateVariables;

};

?>

 

//////////////////////////////

 

and added the first row to domainchecker.tpl

<p>The fixed value is for domainchecker tpl: {$fixedValue}.</p>

 

and to domainchecker-results.tpl

<p>The fixed value is for domainchecker-results tpl: {$fixedValue}.</p>

 

/////////////////////////

Setup -> General -> Security -> Allow Smarty PHP Tags is ON

 

Result:

We can see the hook was called each time when refreshing / and calling by ajax.

 

But at the moment $fixedValue is empty either when refreshing the site and when checking is done by ajax :/

 

Any suggestions are welcome.

 

JG

 

 

 

We would appreciate any suggestions.

Link to comment
Share on other sites

  • 1 month later...
We would appreciate any suggestions.

 

Our workaround is to set a session variable in the DomainValidation hook function and then use it in the template. Referring to your code it would be:

 

<?php
add_hook( "DomainValidation", 1, function ( $vars )
{
   $_SESSION['fixedValue'] = 'abc';
}

 

domainchecker-results.tpl:

<p>The fixed value for domainchecker-results.tpl is: {$smarty.session.fixedValue}.</p>

 

BTW, to do this you do not need to set up 'Allow Smarty PHP Tags' option to ON.

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