Skip to main content

whostmgr hooks metadata

Comments

4 comments

  • Mostafa Hussein
    I made it work thanks
    0
  • cPanelMichael
    I made it work thanks

    Hello, I'm happy to see you were able to obtain the data. Could you let us know the specific solution you found? Thank you.
    0
  • Mostafa Hussein
    The hook wont be able to receive the data as input unless you made it listen to the correct event so instead of listening to `createacct` which from whmapi1 you need to listen to `Accounts::Create` otherwise the hook will receive the data as parameters which has a different json structure. So the question might be why the Hook accepts any kind of event even if its not correct ? and How can I get the correct event name? As you can see in the link mentioned in my question Kenneth Power said that the correct event is Accounts::SiteIP::set and not setsiteip. and both worked same as my case with createacct and Accounts::Create but each one of them returns a different json structure.
    0
  • cPanelMichael
    Hello, You can find the corresponding API function by turning on debug mode under the "Development" tab in "WHM >> Tweak Settings", performing the specific action you want to hook into via cPanel or WHM, and then watching the output from /usr/local/cpanel/logs/error_log. Here's an example of the output you will see when creating an account:
    [2017-03-13 12:02:11 -0500] info [whostmgr5] ---debug_hooks--- [2017-03-13 12:02:11 -0500] info [whostmgr5] msg: No hooks found for traversed context [2017-03-13 12:02:11 -0500] info [whostmgr5] context: Whostmgr::Accounts::Create [2017-03-13 12:02:11 -0500] info [whostmgr5] stage: pre [2017-03-13 12:02:12 -0500] info [whostmgr5] ---debug_hooks--- [2017-03-13 12:02:12 -0500] info [whostmgr5] msg: No hooks found for traversed context [2017-03-13 12:02:12 -0500] info [whostmgr5] context: Whostmgr::Accounts::Create [2017-03-13 12:02:12 -0500] info [whostmgr5] stage: post
    Thus, in this case it shows that you should use "Accounts::Create". Thank you.
    0

Please sign in to leave a comment.