Jump to content
Swehoster

How to skip some products AfterModuleCreate

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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'))) {

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 by DennisHermannsen

Share this post


Link to post
Share on other sites
24 minutes ago, DennisHermannsen said:

I was about to say. That's why I asked what he was trying to skip. 😛

great minds lol. 🙂

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Is there no one that can give me something to test?
I really need to stop the hook for 3 services.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated