The following hooks are provided for Contact related events.
Executes as a contact is being added to WHMCS.
| Variable | Type | Notes |
|---|---|---|
| userid | int | |
| contactid | int | |
| firstname | string | |
| lastname | string | |
| companyname | string | |
| string | ||
| address1 | string | |
| address2 | string | |
| city | string | |
| state | string | |
| postcode | string | |
| country | string | |
| phonenumber | string | |
| tax_id | string | |
| generalemails | bool | |
| productemails | bool | |
| domainemails | bool | |
| invoiceemails | bool | |
| supportemails | bool | |
| affiliateemails | bool |
No response supported
<?php
add_hook('ContactAdd', 1, function($vars) {
// Perform hook code here...
});Executes on Contact Delete after the contact has been removed.
| Variable | Type | Notes |
|---|---|---|
| userid | int | |
| contactid | int |
No response supported
<?php
add_hook('ContactDelete', 1, function($vars) {
// Perform hook code here...
});Executes on validation of contact details.
| Variable | Type | Notes |
|---|---|---|
| N/A | array | The POSTed variables |
Return accepts both a string or an array. Use a string for single error message or an array of strings for multiple error messages.
<?php
add_hook('ContactDetailsValidation', 1, function($vars) {
return [
'Error message feedback error 1',
'Error message feedback error 2',
];
});Runs when a contact is edited.
| Variable | Type | Notes |
|---|---|---|
| userid | int | |
| contactid | int | |
| firstname | string | |
| lastname | string | |
| companyname | string | |
| string | ||
| address1 | string | |
| address2 | string | |
| city | string | |
| state | string | |
| postcode | string | |
| country | string | |
| phonenumber | string | |
| tax_id | string | |
| domainemails | bool | |
| generalemails | bool | |
| invoiceemails | bool | |
| productemails | bool | |
| supportemails | bool | |
| affiliateemails | bool | |
| olddata | array | An array of the previous contact information |
No response supported
<?php
add_hook('ContactEdit', 1, function($vars) {
// Perform hook code here...
});