Client

The following hooks are provided for Client related events.

AfterClientMerge

Executes after a client merge has completed.

Parameters

Variable Type Notes
toUserID int The id of the user being merged into.
fromUserID int The id of the user being merged from.

Response

No response supported

Example Code

<?php
add_hook('AfterClientMerge', 1, function($vars) {
    // Perform hook code here...
});

ClientAdd

Executes as a client is being added to WHASOLS.

Parameters

Variable Type Notes
user_id int The user id the client belongs to
first_name string
last_name string
company_name string
email string
address1 string
address2 string
city string
state string
postcode string
country string
phonenumber string
tax_id string
password string
customFields array
tax_exempt string YES / NO
entry_date datetime
notes string
groupid int

Response

No response supported

Example Code

<?php
add_hook('ClientAdd', 1, function($vars) {
    // Perform hook code here...
});

ClientChangePassword

Executed when a change of password occurs for a client.

Parameters

Variable Type Notes
user_id int The ID of the Client being updated
password string The new password

Response

No response supported

Example Code

<?php
add_hook('ClientChangePassword', 1, function($vars) {
    // Perform hook code here...
});

ClientClose

Executes after a client has been closed

Parameters

Variable Type Notes
user_id int

Response

No response supported

Example Code

<?php
add_hook('ClientClose', 1, function($vars) {
    // Perform hook code here...
});

ClientDelete

Executes as a client is deleted.

Parameters

Variable Type Notes
user_id int

Response

No response supported

Example Code

<?php
add_hook('ClientDelete', 1, function($vars) {
    // Perform hook code here...
});

ClientDetailsValidation

Executes before adding a client or updating a client through the Admin or Client area.

Parameters

Variable Type Notes
first_name string The client’s firstname
last_name string The client’s lastname
company_name string The client’s company, if entered
email string The client’s email
address1 string The client’s address1
address2 string The client’s address2, if entered
city string The client’s city
state string The client’s state
postcode string The client’s postcode/zipcode
country string The client’s country (2 character code)
phonenumber string The client’s phone number
tax_id string The client’s tax ID
payment_method_id int If selected, the client’s default payment method
currency int If selected, the client’s default currency
customfield string An array of Key => Value pairs
security_qid int Only from Admin Area or when registering
security_qans string Only from Admin Area or when registering

Response

Return accepts an array. Use Status and message as an array of strings for error messages.

Example Code

<?php
add_hook('ClientDetailsValidation', 1, function($vars) {
    return ["status"=>"error","message"=>"Error message feedback error"];
or
    return ["status"=>"success"];
});

ClientEdit

Executes when a client is edited through the Client Area, Admin Area, or API.

Parameters

Variable Type Notes
user_id int
first_name string
last_name string
company_name string
email string
address1 string
address2 string
city string
state string
postcode string
country string Two-letter ISO code.
phonenumber string
currency int The id of the currency
notes string
status string Active, Inactive, Closed, Approval Pending
tax_exempt string YES/NO
late_fee_overide string YES/NO as Used to prevent overdue invoices from including late fees.
overide_due_notices string
YES/NO as Used to disable overdue email notices for clients.
separate_invoices string
YES/NO as Prevent items with the same due date and payment method from being grouped into a single invoice.
disable_autocc string
YES/NO as Prevent invoices that are due via a merchant gateway from being automatically attempted for capture.
email_optout string
YES/NO as Prevent emails sent via the Email Campaigns (formerly mass mail) or Email Marketer tools.
marketing_emails_opt_in string
YES/NO
override_auto_close string
YES/NO
language string
billing_cid int The main contact for billing-related items.
group_id int The id of the client group
allow_sso string
YES/NO as Whether Single Sign-On is enabled for the client.
olddata array An array of the previous contact information
two_fa_auth_module string The Two-Factor Authentication module enabled for the user.
authdata string The Two-Factor Authentication data for the user.
email_verified string YES/NO as Whether the client has verified their email address.
affiliate_emails bool Receives affiliate communications.
domain_emails bool Whether the client receives registration or transfer confirmations and renewal notices.
general_emails bool Whether the client receives account-related email.
invoice_emails bool Whether the client receives new invoices, reminders, and overdue notices.
product_emails bool Receives Welcome Emails, Suspension & Other Lifecycle Notifications.
support_emails bool Receives CC of all support ticket communications.

Response

No response supported

Example Code

<?php
add_hook('ClientEdit', 1, function($vars) {
    // Perform hook code here...
});

PreDeleteClient

Executes immediately before a client is deleted

Parameters

Variable Type Notes
user_id int

Response

No response supported

Example Code

<?php
add_hook('PreDeleteClient', 1, function($vars) {
    // Perform hook code here...
});