Where to add code for an operational hook?

Hello,

I made some code for an operational hook and added it to the general custom_functions.php in DDB/include. And it functions.
But when I move that same code to operational_hooks.php in DDB/include/custom_functions, it doesn't work anymore. Any idea?

Kind greetings, Hendrik

Your current DaDaBIK version​

You are using DaDaBIK version 11.6-Elba enterprise, installed on 25/08/2022 (installation code: 133315a7493334bfea), the latest version of DaDaBIK is 11.7-Elba released on 18/08/2022

You are not running the last release of DaDaBIK, the release you are running might have bugs and security holes, see the official change log for further information. You can upgrade DaDaBIK here.

In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enteprise to Platinum) please contact us.

System info​

PHP Version: 7.4.30

mysql version: 10.5.16-MariaDB-cll-lve

Web server: LiteSpeed

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27

URL installation:
 

eugenio

Administrator
Staff member
Do you get any error? If not, I think the problem is that maybe you deleted by mistake the require statements you should have in custom_functions.php. Double check using an untouched DaDaBIK package.

Best,
 
And what are the required statements in custom_functions.php?
For the moment, I use the original, unmodified custom_functions.php.

Kind greetings,

Hendrik
 

eugenio

Administrator
Staff member
If you use the original custom_functions.php, you have the required statements.

Best,
 
Eugenio, I do not understand.
All code lines in custom_funtions.php are commented out.
And I do not want to use the example in that file:
$hooks['accounts']['insert']['after'] = 'dadabik_send_notice_after_accounts_insert';

function dadabik_send_notice_after_accounts_insert($id_account)
{
...


I have written my own hook-function.
Or do I have to keep the $hooks[... command in custom_functions.php and the rest (the function itself) in operational_hooks.php in DDB/include/custom_functions?
Or some link to the hook in operational_hooks.php?

???

Kind greetings,

Hendrik
 

eugenio

Administrator
Staff member
The required statements are not commented out (check the file from your original, untouched dadabik package V 11.6).
Maybe you still have the very old custom_functions.php file before the introduction of the new one in V 10. At some point, after an upgrade, you should have pasted some content there.

I paste here from the change log

you need to paste the content of the the new custom_functions.php file at the end of your old custom_functions.php. In case you already have the statement $cnt = 0; in your old file, delete this statement from the code you have pasted. If you don't do that, you can still use DaDaBIK without issues but you can't take advantage of the new custom files structure (one file for each category of function) introduced in DaDaBIK 10.

Best,
 
OK - thanks Eugenio! Now it works.
By the way: we upgraded from version 8.3 to version 11.6 in one step! Probably we missed some other changes too!
 

eugenio

Administrator
Staff member
The upgrade procedure should have told you to paste that content from custom_functions.php (we didn't do it automatically to avoid accidental overwrite of custom code) so probably you missed that notice. At least I am sure that notice appears if you upgrade a DaDaBIK < 10.0 using any version > 10.4 (between 10.1 and 10.3 it didn't appear, but this is not your case).

Generally speaking, you should read the change log, I know that in your case (8.3 to 11.6!) could be quite long and boring :) but it's useful.

Best,
 
Top