Jump to content

PreModuleCreate -- do I misunderstood the docs?

Recommended Posts


The PreModuleCreate docs states that it is possible to return a "key/value pairs to override the parameters to be used in account creation".

However, I am unable to do it. Here is my hook:


function add_prefix_to_domain($vars) {
    if ($vars['params']['pid'] != 45) {  // ignore everything except my test product

    logActivity('Domain is: ' . $vars['params']['domain']);
    return [
        'domain' => 'hello-' . $vars['params']['domain']

add_hook('PreModuleCreate', 10, add_prefix_to_domain);
add_hook('PreModuleCreate', 20, add_prefix_to_domain);
add_hook('PreModuleCreate', 30, add_prefix_to_domain);

I am expecting to see in the activity log (given that the domain for a service is "world.com"):


Domain is: world.com
Domain is: hello-world.com
Domain is: hello-hello-world.com

What I actually got: 


Domain is: world.com
Domain is: world.com
Domain is: world.com

Do I misunderstood the docs or there is a bug in docs or WHMCS?

Does anyone have a working example of PreModuleCreate hook where the override mechanism actually works? 


Share this post

Link to post
Share on other sites
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.


Important Information

By using this site, you agree to our Terms of Use & Guidelines