matts Posted January 12, 2016 Share Posted January 12, 2016 We have WHMCS version 6 and are trialing a custom hooks to run the some reminder emails on free trial accounts. Bit unsure if the documentation is saying the file in the folder /includes/hooks/ must be called hooks.php http://docs.whmcs.com/Addon_Module_Developer_Docs Can you please confirm this is the case the filename has to be hooks.php ? Also is there an easy way to check that it has been run after the scheduled "DailyCronJob" thanks. Link to comment Share on other sites More sharing options...
sentq Posted January 12, 2016 Share Posted January 12, 2016 Bit unsure if the documentation is saying the file in the folder /includes/hooks/ must be called hooks.php If you need to create ActionHooks file for your custom addon module your file should to be called hooks.php and its location is in your addon module directory /modules/addons/your-addon/hooks.php but if you only need to create ActionHook file to make some changes in your WHMCS installation, then the file location is /includes/hooks/ and it can named anything.php Can you please confirm this is the case the filename has to be hooks.php ? answer above Also is there an easy way to check that it has been run after the scheduled "DailyCronJob" thanks. you can use logActivity() function so your action hook will add record before or after task is completed Link to comment Share on other sites More sharing options...
matts Posted January 14, 2016 Author Share Posted January 14, 2016 Brilliant thanks for the answer. Understood now about the naming convention for hooks. I have all the php for the module in the same file as the hook command (last line). add_hook("DailyCronJob",1,"end_free_trials_hook"); So if I understand you correctly I can add logActivity("end_free_trials_hook"); If so where am I looking for this log, not utilities > Logs > modules Although I do have another module that is not functioning that I need help with adding logModuleCall syntax. Link to comment Share on other sites More sharing options...
sentq Posted January 14, 2016 Share Posted January 14, 2016 let's say you ActionHook function is like the following, and at the end of the function logic we need to add log record: <?php function end_free_trials_hook($vars){ // Your Code Logic logActivity("EndFreeTrials Function Completed."); } add_hook("DailyCronJob", 1, "end_free_trials_hook"); after the daily cron job process completed, your function will run and add new log record. you can find those records in Utilities -> Logs -> Activity Log Link to comment Share on other sites More sharing options...
matts Posted January 14, 2016 Author Share Posted January 14, 2016 Very good I see so logActivity function puts a message after every run in menu Utilities -> Logs -> Activity Log. As you seem to know about logs the modules / registrars / domainbox.php is giving errors it came from the Registrar. I'm trying this to debug it ; logModuleCall("domainbox","RegisterDomain","RegisterDomainResult","error"); Trying to get a verbose output to Utilities -> Logs -> Modules log Link to comment Share on other sites More sharing options...
matts Posted January 14, 2016 Author Share Posted January 14, 2016 Also tried this syntax logModuleCall($domainbox,$RegisterDomain,$RegisterDomainResult,$registrant,$AuthenticationParameters); Nothing new appearing in Utilities -> Logs -> Modules log Link to comment Share on other sites More sharing options...
sentq Posted January 17, 2016 Share Posted January 17, 2016 here is the right syntax for the module log function from WHMCS module sample: logModuleCall( (string) 'moduleName', (string) 'FunctionName', (array) $params, (string) "Error Message", "" ); - - - Updated - - - also you need to "Enable Debug Logging" in Utilities -> Module Log, so it will save log records in DB when the "logModuleCall" function is called. Link to comment Share on other sites More sharing options...
Sir Jeff Posted January 30, 2018 Share Posted January 30, 2018 HI matss did you get around this? I am actually trying to send txt to individual customers with overdue invoices... Link to comment Share on other sites More sharing options...
twhiting9275 Posted January 30, 2018 Share Posted January 30, 2018 This thread is a couple of years old, may want to start your own There are, however, a couple of products in the marketplace that can do what you're after. Take a look through there Link to comment Share on other sites More sharing options...
Recommended Posts