Jump to content

PreModuleChangePackage hook to override configoptions not working


GlennT

Recommended Posts

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&quota=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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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