lunaticnoise Posted February 24, 2017 Share Posted February 24, 2017 (edited) Hello, I have a file /includes/hooks/hooks.php with the following code: <?php add_hook('ClientAreaPage', 1, function($vars) { var_dump("ClientAreaPage"); }); add_hook('AdminAreaPage', 1, function($vars) { var_dump("AdminAreaPage"); }); add_hook('PreRegistrarGetDNS', 1, function($vars) { var_dump("PreRegistrarGetDNS"); }); add_hook('AfterRegistrarGetDNS', 1, function($vars) { var_dump("AfterRegistrarGetDNS"); }); add_hook('PreRegistrarSaveNameservers', 1, function($vars) { var_dump("PreRegistrarSaveNameservers"); }); add_hook('AfterRegistrarSaveNameservers', 1, function($vars) { var_dump("AfterRegistrarSaveNameservers"); }); add_hook('AfterRegistrarGetContactDetails', 1, function($vars) { var_dump("AfterRegistrarGetContactDetails"); }); add_hook('PreRegistrarGetContactDetails', 1, function($vars) { var_dump("PreRegistrarGetContactDetails"); }); I am trying to execute some of the above hooks, but only ClientAreaPage and AdminAreaPage are called when I visit any page of clientside or adminside. I know that PreRegistrarGetDNS, AfterRegistrarGetDNS, PreRegistrarSaveNameservers, AfterRegistrarSaveNameservers, AfterRegistrarGetContactDetails and PreRegistrarGetContactDetails are only called in few actions, for example when the domain register is getting the nameservers, contact details or saving dns records so I go to any admin domain page to force these hooks but sadly they are never called. I also have few breakpoint in the code but the debuger only stops at ClientAreaPage and AdminAreaPage hooks. Is anyone having this issue? My WHMCS version is 7.1.1 Edited February 24, 2017 by lunaticnoise Php code within tags to better reading 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 24, 2017 Share Posted February 24, 2017 what does this line mean? var_dump("AfterRegistrarGetDNS"); 0 Quote Link to comment Share on other sites More sharing options...
lunaticnoise Posted February 24, 2017 Author Share Posted February 24, 2017 it doesn´t mean anything, only to stop the debugger 0 Quote Link to comment Share on other sites More sharing options...
lunaticnoise Posted February 25, 2017 Author Share Posted February 25, 2017 Anyone is able to execute these all hooks? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 25, 2017 Share Posted February 25, 2017 var_dump will not stop the process, you mean need to use "exit" instead. I believe they all executed, but you may not get any output this way, if you need to do something specific you may describe it for me to provide proper solution 0 Quote Link to comment Share on other sites More sharing options...
lunaticnoise Posted February 26, 2017 Author Share Posted February 26, 2017 Maybe I did not explain proper the problem. var_dump is only a php sentence to stop the debuger (xdebug), you can forget about the result of the var_dump() function. The only hooks executed in my installation are ClientAreaPage and AdminAreaPage, the rest in the first post are never executed. I can assure that, because I have IDE breakpoints in all of them and the process never stops there, it only stops at ClientAreaPage and AdminAreaPage. It is very extrange behaviour, isn't it? senq thanks for your time and responses! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted February 27, 2017 Share Posted February 27, 2017 try to debug it using this code: <?php add_hook('ClientAreaPage', 1, function($vars) { var_dump("ClientAreaPage"); }); add_hook('AdminAreaPage', 1, function($vars) { var_dump("AdminAreaPage"); }); add_hook('PreRegistrarGetDNS', 1, function($vars) { logActivity("Debug: PreRegistrarGetDNS"); }); add_hook('AfterRegistrarGetDNS', 1, function($vars) { logActivity("Debug: AfterRegistrarGetDNS"); }); add_hook('PreRegistrarSaveNameservers', 1, function($vars) { logActivity("Debug: PreRegistrarSaveNameservers"); }); add_hook('AfterRegistrarSaveNameservers', 1, function($vars) { logActivity("Debug: AfterRegistrarSaveNameservers"); }); add_hook('AfterRegistrarGetContactDetails', 1, function($vars) { logActivity("Debug: AfterRegistrarGetContactDetails"); }); add_hook('PreRegistrarGetContactDetails', 1, function($vars) { logActivity("Debug: PreRegistrarGetContactDetails"); }); run few tests, then go to Utilities -> Logs -> Activity Logs, and check if there is any records in there started with "Debug: " 0 Quote Link to comment Share on other sites More sharing options...
lunaticnoise Posted February 28, 2017 Author Share Posted February 28, 2017 I have change a little bit the code, to show you how only the ClientAreaPage and AdminAreaPage hoos run. add_hook('ClientAreaPage', 1, function($vars) { logActivity("Debug: ClientAreaPage"); }); add_hook('AdminAreaPage', 1, function($vars) { logActivity("Debug: AdminAreaPage"); }); add_hook('PreRegistrarGetDNS', 1, function($vars) { logActivity("Debug: PreRegistrarGetDNS"); }); add_hook('AfterRegistrarGetDNS', 1, function($vars) { logActivity("Debug: AfterRegistrarGetDNS"); }); add_hook('PreRegistrarSaveNameservers', 1, function($vars) { logActivity("Debug: PreRegistrarSaveNameservers"); }); add_hook('AfterRegistrarSaveNameservers', 1, function($vars) { logActivity("Debug: AfterRegistrarSaveNameservers"); }); add_hook('AfterRegistrarGetContactDetails', 1, function($vars) { logActivity("Debug: AfterRegistrarGetContactDetails"); }); add_hook('PreRegistrarGetContactDetails', 1, function($vars) { logActivity("Debug: PreRegistrarGetContactDetails"); }); I have made some test, getting the domain contacts and one change on nameservers and please see the attached 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.