I am trying to use the PreModuleChangePackage hook to override the configoptions disk space value to effectively convert it from GB to MB as required by the cPanel module.
function ww_PreModuleChangePackage($vars) {
$return = array();
if($vars['params']['producttype'] == "hostingaccount") {
$cp_quota = $vars['params']['configoptions']['Disk Space'] * 1024;
$return['params']['configoptions']['Disk Space'] = $cp_quota;
}
logModuleCall('ww', 'PreModuleChangePackage', '', $vars, $return, array());
return $return;
}
add_hook('PreModuleChangePackage', 1, 'ww_PreModuleChangePackage');
The logModuleCall function logs the correct disk quota in MB
Array
(
[params] => Array
(
[configoptions] => Array
(
[Disk Space] => 15360
)
)
)
But the cPanel module log shows editquota still passing the GB amount to cPanel
api.version=1&user=abcde"a=15
I was told by WHMCS support that it can be done this way and going by the documentation, it should work. So what am I missing?
Any assistance will be greatly appreciated!
Thanks.