Swehoster Posted November 8, 2019 Share Posted November 8, 2019 Hi, I need help with a hook "AfterModuleCreate". I need it to skip running on certain products. I've tried with the following: add_hook("AfterModuleCreate",0,"runFeatureHook",""); if (!($vars['params']['pid'] === '123') || ($vars['params']['pid'] === '124') || ($vars['params']['pid'] === '125')) { function runFeatureHook($vars) { my-function } } Best regards Fredrik 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted November 8, 2019 Share Posted November 8, 2019 What is it that you need to skip? 0 Quote Link to comment Share on other sites More sharing options...
Swehoster Posted November 8, 2019 Author Share Posted November 8, 2019 It runs on every hosting service at the moment. I would like to exclude a couple of produtcs that don't need this to be run. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 8, 2019 Share Posted November 8, 2019 Hi Fredrik, for that if statement, I would be tempted to use !in_array for something like this... if (!in_array($vars['params']['pid'],array('123','124','125'))) { 0 Quote Link to comment Share on other sites More sharing options...
Swehoster Posted November 8, 2019 Author Share Posted November 8, 2019 Thank you Brian. I tried that but it when I run module create on order with that pid it still provisioned the AfterModuleCreate. I just can't understand why this doesn't work? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 8, 2019 Share Posted November 8, 2019 23 minutes ago, Swehoster said: I just can't understand why this doesn't work? hang on, shouldn't you be using PreModuleCreate instead ?? AMC -> Executes upon successful completion of the module function. PMC -> Executes prior to the module create function being run for a service. Allows the action to be aborted. 0 Quote Link to comment Share on other sites More sharing options...
DennisHermannsen Posted November 8, 2019 Share Posted November 8, 2019 (edited) 7 minutes ago, brian! said: hang on, shouldn't you be using PreModuleCreate instead ?? I was about to say. That's why I asked what he was trying to skip. 😛 As far as I can think, the only thing you would be able to skip is the email sending. You can skip module create by returning abortcmd=true Edited November 8, 2019 by DennisHermannsen 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted November 8, 2019 Share Posted November 8, 2019 24 minutes ago, DennisHermannsen said: I was about to say. That's why I asked what he was trying to skip. 😛 great minds lol. 🙂 0 Quote Link to comment Share on other sites More sharing options...
Swehoster Posted November 11, 2019 Author Share Posted November 11, 2019 Thank you. We have a module that runs just fine. When this is done we have a hook that do some extra stuff after the module is run. It's this that I would like to skip for 3 services, while running for all other services. 0 Quote Link to comment Share on other sites More sharing options...
Swehoster Posted November 13, 2019 Author Share Posted November 13, 2019 Is there no one that can give me something to test? I really need to stop the hook for 3 services. 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.