3rd Party Modules & Code Hooks
SPBAS offers a variety of code hooks that are triggered as various events unfold at runtime. You can use the code hooks to extend the core functionality of SPBAS via 3rd party modules. This article will show you how.
How it works.
3rd party modules consist of directories and files named a certain way that are stored at specific locations within SPBAS. The core components of every 3rd party module are the module directories, code hooks and settings files.
Module Directories
The module directory names must consist of only letters and numbers (A-Z, a-z, 0-9). The first character of your module name must be a letter (A-Z, a-z). Use the underscore character instead of spaces (_) when naming your module.
For this article our module name is example.
Example Structure:
admin/modules/3rd_party/modules/example/model
admin/modules/3rd_party/modules/example/view
Code Hooks
Code hooks are PHP functions that are triggered at runtime for specific events as they occur. The functions are stored in the core component file run.php. It is very important to note that code hooks are prefixed with the module directory name.
The code hooks file is named run.php and will contain only code hooks.
Example Structure:
admin/modules/3rd_party/modules/example/model/run.php
Settings
The settings files are optional. You'll only need them if your module needs to be configured from the admin area. The files will always be named settings.php
Example Structure:
A. admin/modules/3rd_party/modules/example/model/settings.php
B. admin/modules/3rd_party/modules/example/view/settings.php
File A is the form handler (model) while file B is the template (view).
Available Code Hooks
*_order_form_order_complete
*_customer_area_new_user_registered
*_order_form_new_user_registered
*_admin_new_user_registered
*_order_form_update_user
*_customer_area_update_user
*_admin_update_user
*_order_form_user_login
*_customer_area_user_login
*_customer_area_resend_password
*_order_form_resend_password
*_customer_area_change_password
*_customer_area_add_contact
*_customer_area_update_my_info
*_helpdesk_import_new_user_registered
*_helpdesk_create_new_ticket_new_user_registered
*_before_payment_item_name_sent_to_processor
*_after_license_key_creation
*_after_package_creation
*_after_domain_package_creation
*_at_api_request
*_at_phpaudit_license_invalid
*_admin_before_user_delete
*_helpdesk_before_user_delete
*_at_license_key_creation
*_license_validation_before_new_instance_added
Replace the * in the code hooks above with the module directory name (e.g. example_admin_update_user) and store the functions in run.php.
Putting it all together
You can use the Example module in the SPBAS distribution to create your own. Have questions?



