Hooks and Events in HostBill
After every important action taken in HostBill its engine report
When
Event
. PHP code executed when event occurs are called Hooks
.When
Event
occurs, HostBill executes related Hooks
code and passes event data as variable to them.
Note: hooks does not require any configuration files, or special classes / structures.
If you’d like to incorporate hooks into Plugin/Provisioning/Domain module follow guides mentioned in Module Events article
Hooks location
Hooks are located inside
includes/extend/hooks
directory. Each HostBill installation is shipped with the sample hook files.
Adding hooks
- Go to
includes/extend/hooks
directory and remove.sample
extension from hook you’d like to use - Edit related hook file i.e.
after_accountcreate_01.php
place php code there that should be executed when the event occurs
Using multiple hooks
You can use multiple files for each event. To add another hook create a file in hooks directory with following naming convention:
{event_name}_{PRIORITY}.php
Where:
{event_name}
is one of the events you wish to hook, from the list below
{PRIORITY}
is a number, telling HostBill in which order to execute files. HostBill executes hook files from the lowest number up.
File: after_accountcreate_01.php
<?php //each sample hook file contains available variable explained in comment inside echo "New account has been created!"; exit; ?>
Events in HostBill
-
- after_accountchangepackage
- after_accountchangepassword
- after_accountcreate
- after_accountformsupgrade
- after_accountsuspend
- after_accountterminate
- after_accountunsuspend
- after_addoncreate
- after_addonsuspend
- after_addonterminate
- after_cancellationrequest
- after_clientadded
- after_clientchangepassword
- after_clientdelete
- after_clientedit
- after_clientlogin
- after_clientlogout
- after_cronrun
- after_domainregister
- after_domainrenew
- after_domainsave
- after_domaintransfer
- after_estimatecreate
- after_invoicecreate
- after_invoicefullpaid
- after_invoicelatefee
- after_invoicepartialpayment
- after_invoiceupdatetotal
- after_ordercreate
- after_refund
- after_ticketadminreply
- after_ticketclientreply
- after_ticketdelete
- after_ticketopen
- after_transactionadd
- before_clientlogin
- before_clientadded
- before_clientdelete
- before_displayadminfooter
- before_displayadminheader
- before_displayuserfooter
- before_displayuserheader
- before_domainregister