07-27-2023, 12:10 AM
After reading through the [WHMCS documentation][1] on hooks, I am still a little confused about where to begin to trigger custom code when a Product is suspended or terminated.
Here is an example of the code I have in a file in `includes/hooks`:
function hook_MyHookTest($vars) {
mail('[email protected]', 'WHMCS Test', "This hook test was successful!\n\n" . date('r'));
}
add_hook('AfterModuleSuspend', 1, 'hook_MyHookTest');
In the `Products/Services` tab of the Client Profile, when I change the `Status` of the product from "Active" to "Suspended", nothing happens. I've used the function `hook_MyHookTest` with other hooks successfully, so I'm probably not understanding how `AfterModuleSuspend` is used.
Does another "Module" need to be created from scratch in order to use this hook?
[1]:
Here is an example of the code I have in a file in `includes/hooks`:
function hook_MyHookTest($vars) {
mail('[email protected]', 'WHMCS Test', "This hook test was successful!\n\n" . date('r'));
}
add_hook('AfterModuleSuspend', 1, 'hook_MyHookTest');
In the `Products/Services` tab of the Client Profile, when I change the `Status` of the product from "Active" to "Suspended", nothing happens. I've used the function `hook_MyHookTest` with other hooks successfully, so I'm probably not understanding how `AfterModuleSuspend` is used.
Does another "Module" need to be created from scratch in order to use this hook?
[1]:
[To see links please register here]