Jump to content

preModuleCreate executes on various events


alankis

Recommended Posts

Hi folks,

 

I am programming custom module/addon, with hook, which is going to execute when module is activated, and sent a Terms of Use and Contract in PDF to user. But problem, is that hook is running on product change, even delete action.

 

<?php
error_reporting(E_ALL);
require_once 'functions.php';
function hook_TestExternalFunction($params) 
{
 // pokreni renewal funkciju iz samog modula
 //termsaddon_TestFunction();
}

add_hook("PreModuleCreate",1,"hook_TestExternalFunction");  

 

Also, I am curious, code in function.php, which is only included in hooks.php is getting executed, without function call in hook_ definition. Is this expected, or should I explicitly make function call in hook call as follow bellow?

 

File: hooks.php

 

require_once 'functions.php';

function hook_TestExternalFunction($params) 
{
 // run function from functions.php
 termsaddon_TestFunction();
}

add_hook("PreModuleCreate",1,"hook_TestExternalFunction");  

 

File: functions.php

 

function termsaddon_TestFunction() { .. do something .. send mail ... }

Link to comment
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.

×
×
  • 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