Action Hooks

Customization BuildX


Perfex CRM support various action hooks all over the code to give the buyers the best experience.

Create file with name my_functions_helper.php in application/helpers/. This file is reserved for all your functions.

TIP: If you need some action hook added anywhere in the code please let us know by opening  ticket.

Before add any code in my_functions_helper.php, make sure that you set development mode in order to see any errors and functions/hooks deprecation warnings.

Version 2.3.0 and above.

hooks()->add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1); hooks()->add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1); hooks()->do_action($tag, $arg = ''); hooks()->apply_filters($tag, $value, $additionalParams);
The functions below are prior to version 2.3.0

Add Action Hook

add_action('action_function','your_function_callback');

Example action hook for after_client_added
Note: this code should be inside my_functions_helper.php mentioned earlier.

This is example where the action do not expect to return $data.

 function callback_after_client_added_insert_to_local_database($id) { $clientid = $id; // Do Staff with $clientid } add_action('after_client_added','callback_after_client_added_insert_to_local_database'); 

Example action hook for before_client_added
This is example where the action expect to return $data

 function callback_before_client_added_check_company($data) { if($data['company'] == 'Test'){ $data['company'] = ''; } return $data; } add_action('before_client_added','callback_before_client_added_check_company'); 

Did you find this article useful?