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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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