Jump to content

ClientAreaPage hook and domainchecker with six template


imaticon

Recommended Posts

Hi,

 

The hookpoint "ClientAreaPage" is not invoked if you do a domain search from the domainchecker.php using the six template.

 

However, if you do a domain search from the whmcs main index.php, then the hook works as expected.

 

<?php
function load_the_hook($params) {
   $params['world'] = "Hello World";
   return $params;
}

add_hook("ClientAreaPage",1,"load_the_hook");
?>

 

Regards,

Marco

Link to comment
Share on other sites

Hello Marco,

 

The hook is triggered when the page is reloaded, when you do a domain search from domainchecker.php, you are making an AJAX call that does not reload the page. While you can trigger hooks when the domainchecker.php is loaded directly, you can't do anything on the AJAX call.

 

If you need to take action on the ajax call you will need to wrap the javascript.

 

Have a great day,

 

Nate C

Link to comment
Share on other sites

Marco,

 

I am not sure what the question you are asking is. Let me try this, using a hook point that makes a logActivity() call when its hit. Can you walk step by step what you want triggered and what it is currently doing? If you can explain your end goal as well that would be helpful, right now I am not really able to figure out what you are looking for here.

 

Nate C

Link to comment
Share on other sites

Hi Nate,

 

Sure, the goal is simply adding the smarty variable {$world} when it comes to a domain lookup. As I can see the domainchecker.js calls the domainchecker.php and this should trigger the hookpoint "ClientAreaPage"

 

<?php
function load_the_hook($params) {
   $params['world'] = "Hello World";
   return $params;
}

add_hook("ClientAreaPage",1,"load_the_hook");
?> 

 

Regards,

Marco

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

I have confirmed that the HookPoint is called on initial load of doaminchecker.php, but its not called when the ajax call is made to search for a specific string. This follows the pattern of how ajax calls are managed within the product. We don't call the Page Load Hooks for AJAX calls anywhere else. This follows my comment on 09-29-15 that this is not a bug.

 

What is the actual end goal you are trying to accomplish here?

 

Nate C

Link to comment
Share on other sites

Hi Nate,

 

Triggering the hook point only on the domainchecker initial access is quite useless. Without calling the hook point when it comes to a domain lookup we will not be able to execute custom code to process the domain lookup results.

 

For example, we need to know the searched sld and tld to do additional stuff.

 

We don't call the Page Load Hooks for AJAX calls anywhere else

 

This is not correct Nate. The mentioned hook point is called and correctly triggered when you do a lookup using the new standard_cart or any other ajax orderform. Simply use the provided example above and you will have the smarty variable available when you do a domainlookup from the shopping cart.

 

Right now, the domain checker using the six template is completely inaccessible and any third party developer will not be able to hook into a domain lookup and this is a really really bad situation.

 

Regards,

Marco

Link to comment
Share on other sites

Marco,

 

The domain checker results in 6.0 are not passed through the smarty template layer, instead the information is returned as a json object and then put on the screen via javascript. The base elements to adjust the display are already present on the page when this happens. So there is no way we can add some variables to a smarty page that has already been rendered that allows you to do anything relevant.

 

Going forward you have two options:

 

1) You can edit the search button to do a post action instead of triggering JS. If you post the search actions into the domainchecker.php the on load hook event will trigger, go through the smarty layer and render your changes.

 

2) You can modify the JS that is run to have the search button call your own function, which makes the ajax call, and then process the results in javascript. If your code needs to do further actions that can only be written in php, you can make an addon module that gets calls from your code and executes whatever is required.

 

Suggesting that the design of the domain checker as it currently stands is completely inaccessible to any third party developer is simply not factually true. It is not behaving the way you think it should be.

 

I am going to close this thread. If you want to discuss further implementation details of either of the methods I have mentioned, I am happy to discuss it over email with you. Just send me a private message and I will reply with my email address. This forum area is specifically reserved for reporting places where the software does not behave the way the designers intended it to.

 

Have a great day,

 

Nate C

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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