Jump to content

PreModuleCreate -- do I misunderstood the docs?


sdv

Recommended Posts

Hello,

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:

<?php

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

    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"):

Quote

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

What I actually got: 

Quote

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? 

Thanks!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • 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