EpoxyElegant Posted December 24, 2018 Share Posted December 24, 2018 Hello, I'm trying to use the AfterModuleCreate hook but I don't understand how or what triggers this hook. The documentation says, "Executes upon successful completion of the module function." I thought that was helpful enough but it's not. What module function? What determines it's success? When does this happen? Is it after adding an order? Can this be triggered when adding an order from the admin dashboard immediately without changing any of the status? Thank you. 0 Quote Link to comment Share on other sites More sharing options...
EpoxyElegant Posted December 24, 2018 Author Share Posted December 24, 2018 I can't edit my post, so I'll write this here. What I'm trying to do is run a script that will trigger right after an Administrator creates a new order. The hook will grab the order and executes some codes to do stuff internally. I tried AfterModuleCreate, but the hook wasn't triggered after adding an order from the admin dashboard. I also added some lines of codes that should add an entry into the Modules Log. No entries were added so I assumed it did not work. So what hook should I use? Why can't WHMCS just make a hook that is executes after an order has been placed and checked out (completed), regardless of it being paid or not. $params should provide us those value about the payment and whether it's from admin or client. Or just make two separate hooks for that. But anyway, I have to make do with just what I have right now. I'm certain that AfterModuleCreate is the right one but I still can't get it to work. 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Marcus Posted December 24, 2018 Share Posted December 24, 2018 This hookpoint is executed any time the _ModuleCreate function is ran. This would be any time a module is provisioned. This would happen when a staff member manually presses the Create button from the Client's Products/Services account, when a customer places an order and the Run Module Create function is executed. If an administrator creates an order, this would run when the administrator Accepts the order and the Run Module Create box is ticked. This only runs, however, if the creation function is successful. 0 Quote Link to comment Share on other sites More sharing options...
RadWebHosting Posted December 24, 2018 Share Posted December 24, 2018 To answer the original question of what triggers the hook 'AfterModuleCreate', is successful ModuleCreate function. This hook would execute upon successful completion of ModuleCreate function. 0 Quote Link to comment Share on other sites More sharing options...
EpoxyElegant Posted December 27, 2018 Author Share Posted December 27, 2018 Thank you, @WHMCS Marcus and @radwebhosting. So, in order to make this work with an admin created order, the order need to be accepted first. Is there a hook that I can use so that my script would be executed immediately after adding an order for a specific type of products? 0 Quote Link to comment Share on other sites More sharing options...
EpoxyElegant Posted January 2, 2019 Author Share Posted January 2, 2019 Hi, sorry for the bump. Not sure if I should make a new thread since I asked the question in this thread although the question is a different question than the one in the OP. I explained the need in the 2nd post, however. Anyway, the question was, is there any hook that I can use that would trigger immediately after an Admin created a new order into a customer's account? I want to use the hook to run some custom codes or scripts and then send out an email to the customer about the new order which the Admin added into their account. Thank you in advance! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.