\Customers\Contacts
Templating
Global Functions
Website
\Components\Website\Designs \Components\Website\Media \Components\Website\Pages \Components\Website\Pages\Forms \Components\Website\Posts \Components\Website\Posts\Categories
Customers
\Components\Customers\Contacts
METHODS
\Components\Customers\Contacts\Relationships \Components\Customers\Contacts\Relationships\Types \Components\Customers\Groups
Marketing
\Components\Marketing\EmailMarketing \Components\Marketing\Events \Components\Marketing\Events\Attendees \Components\Marketing\Events\Categories \Components\Marketing\Events\Locations
Commerce
\Components\Commerce\Carts \Components\Commerce\Carts\Current \Components\Commerce\Configuration\PaymentMethods \Components\Commerce\Configuration\ShippingMethods \Components\Commerce\Discounts \Components\Commerce\Products \Components\Commerce\Products\Brands \Components\Commerce\Products\Categories \Components\Commerce\Products\Inventory \Components\Commerce\Sales \Components\Commerce\Sales\Items \Components\Commerce\Sales\Receipts \Components\Commerce\Sales\Receipts\Allocations
Settings
\Components\Settings\Administrators \Components\Settings\CustomFields \Components\Settings\Domains
Other Apps
\Components\Website\Comments \Components\Commerce\Affiliates \Components\Commerce\Affiliates\Administrators \Components\Commerce\Affiliates\Commissions \Components\Commerce\Affiliates\Payments \Components\Commerce\RecurringSales \Components\Commerce\RecurringSales\StoredCards
Framework
\Framework\Caching \Framework\Data\Util \Framework\DOM\CurrentContext \Framework\HTML\Converters \Framework\HTTP\Cookies \Framework\HTTP\Redirection \Framework\HTTP\Request \Framework\HTTP\Session \Framework\HTTP\UserAgent \Framework\I18N\CompanyTypes \Framework\I18N\Countries \Framework\I18N\Languages \Framework\Network\GeoIP

Contacts

Use this API to create, update and delete contacts.
If you are just looking to create forms that collect contacts in a secure manner, it is recommended that you use the forms:form control with the contactmode attribute.

Security Warning: With great power comes great responsibility. This API is for experienced developers to query data from the contacts component. Customer data is sensitive, so you must take great care not to introduce a data leak or vulnerability.
Security Warning: You can retreive contact data via functions such as get() and getAll(). This can be displayed on a public website through the use of a repeater or varDump().
Security Warning: This API also allows you to save customer data. Ensure that if updating existing records, any supplied contact_id is validated so only the intended contacts can be overwritten.

Methods

Invoke via \Components\Customers\Contacts::method()
Click a method name to copy it.
- ` array current() `
Returns the current contact logged in
Return
Contact
- ` string currentAddress() `
Returns a HTML formatted address for the contact
Return
Contact's full address
- ` int|null currentContactId($bTrackingFallback) `
Returns the id of the contact currently logged in
Parameters:
- $bTrackingFallback
mixed
Return
Id
- ` string currentCountry() `
Returns the country of the current contact

This function will always return a country code as it will fall back to the user's
GeoIP location if not logged in.
Return
string
- ` string currentEmail() `
Returns the email address of the contact currently logged in
Return
Email Address
- ` string currentFullName() `
Gets the user's full name
Return
Contact's first and last names as a concatenated string
- ` string currentGetColumn($strColumn) `
Retreives an attribute for the current user
Parameters:
- $strColumn
mixed
Return
Value of the attribute
- ` bool currentHasPassword() `
Returns whether the user is fully registered or not
Return
true if the user has a password, else false
- ` bool currentIsLoggedIn($bTrackingFallback) `
Returns whether or not the user is logged in.
Parameters:
- $bTrackingFallback
mixed
Return
true if logged in, else false
- ` bool currentIsLoggedInThisSession() `
Returns whether the user logged in this session or not
Return
true if logged in this session, else false
- ` void currentLogout() `
Logs out the current user
- ` void currentSaveColumn($strColumn, $strValue) `
Sets an attribute for the current user
Parameters:
- $strColumn
mixed
- $strValue
mixed
- ` void currentSetCountry($strCountryId, $bSave) `
Parameters:
- $strCountryId
mixed
- $bSave
mixed
- ` string currentSuggestUsername() `
Suggests a unique username based on the users name
Return
Username
- ` array get($iContactId, $bRemoteConnect) `
Gets a record from the database
Parameters:
- $iContactId
int
A record's contact_id
- $bRemoteConnect
mixed
Return
- ` array getAll($arrQuery) `
Return a set of records from the database
Parameters:
- $arrQuery
mixed
Return
Array of Contacts
- ` array getAllForEmail($strEmail, $arrQuery) `
Returns all contact records for a given email address
Parameters:
- $strEmail
mixed
- $arrQuery
mixed
Return
Array of Contacts
- ` mixed getColumn($iContactId, $strColumn) `
Gets a single field from a record
Parameters:
- $iContactId
int
A record's contact_id
- $strColumn
mixed
Return
mixed
- ` int getCount($arrFilter) `
Returns the number of records in the database (matching the filter if specified)
Parameters:
- $arrFilter
mixed
Return
int
- ` int getKeyFromEmail($strEmail) `
Returns the contact id from an email address
Parameters:
- $strEmail
mixed
Return
Contact id
- ` bool delete($iContactId, $bDeleteMedia) `
Deletes a record from the database
Parameters:
- $iContactId
int
A record's contact_id
- $bDeleteMedia
mixed
Return
Returns true if record existed and was deleted, otherwise false
- ` void impersonateBegin($iContactId) `
Assumes the role of a user for segment
Parameters:
- $iContactId
mixed
- ` void impersonateEnd() `
Resumes the role of the previous impersonation
- ` int impersonateRealContactId($bTrackingFallback) `
Returns the root user id
Parameters:
- $bTrackingFallback
mixed
Return
$iContactId
- ` void renderAddressForContact($arrContact) `
Parameters:
- $arrContact
mixed
- ` void renderAdmin($iContactId, $strLinkTarget, $bShowEmailMarketing, $bShowAdministrators, $strLink) `
Parameters:
- $iContactId
mixed
- $strLinkTarget
mixed
- $bShowEmailMarketing
mixed
- $bShowAdministrators
mixed
- $strLink
mixed
- ` void renderName($arrContact, $bLastNameFirst) `
Parameters:
- $arrContact
mixed
- $bLastNameFirst
mixed
- ` void renderPhoneNumbersForContact($arrContact) `
Parameters:
- $arrContact
mixed
- ` void renderSaleBalance($arrContact, $bUseName) `
Parameters:
- $arrContact
mixed
- $bUseName
mixed
- ` string|int save($arrEntity) `
Saves a record into the database
Parameters:
- $arrEntity
mixed
Return
string|int
- ` void saveColumn($iContactId, $strColumn, $strValue) `
Saves a specific column of a row into a database
Parameters:
- $iContactId
int
A record's contact_id
- $strColumn
mixed
- $strValue
mixed
- ` array search($strSearch, $arrQuery) `
Performs a search
Parameters:
- $strSearch
mixed
- $arrQuery
mixed
Return
Array of Contacts that match the search query.
- ` array titlesGetAll() `
Returns an array of all possible contact_title / salutation values (Mr., Mrs., etc.)
Return
array

Database Fields

The following fields are used when retrieving and saving entities:
- `contact_id`
int (11)
- `contact_created_datetime`
datetime
Default value: current_timestamp()
- `contact_updated_datetime`
datetime
Default value: current_timestamp()
- `contact_last_online`
datetime
Default value: current_timestamp()
- `contact_username`
string (63)
- `contact_email`
string (127)
- `contact_email_secondary`
string (127)
- `contact_email_secondary_cc`
0 or 1
- `contact_email_marketing_status`
Default value: pending
- `contact_email_bounce_count_soft`
int unsigned
- `contact_email_bounce_count_hard`
int unsigned
- `contact_general_communication_unsubscribe`
datetime
- `contact_cookie_token`
string (32)
- `contact_cookie_token_tracking`
string (32)
- `contact_password_lost`
string (32)
- `contact_password_url`
string (32)
- `contact_password_requires_change`
0 or 1
- `contact_type`
Default value: Individual
- `contact_gender`
string (31)
- `contact_title`
- `contact_first_name`
string (63)
- `contact_last_name`
string (63)
- `contact_address`
string (127)
- `contact_suburb_city`
string (127)
- `contact_postcode`
string (16)
- `contact_state`
string (127)
- `country_id`
char (3)
- `contact_timezone`
- `contact_dob`
date
- `contact_company`
string (127)
- `contact_company_number_type`
string (127)
- `contact_company_number`
string (127)
- `contact_company_tax_registered`
0 or 1
Default value: 1
- `contact_phone_home`
string (31)
- `contact_phone_work`
string (31)
- `contact_phone_mobile`
string (31)
- `contact_phone_mobile_e164`
string (31)
- `contact_phone_mobile_verification_code`
string (6)
- `contact_phone_mobile_verification_code_datetime`
datetime
- `contact_phone_mobile_sms_optout`
int unsigned (1)
- `contact_phone_mobile_sms_bounce_count`
int unsigned
- `contact_social_facebook_url`
string (127)
- `contact_social_twitter_url`
string (127)
- `contact_social_linkedin_url`
string (127)
- `contact_social_youtube`
string (127)
- `contact_social_instagram`
string (127)
- `contact_website`
string (255)
- `contact_picture`
string (255)
- `contact_profile`
0 or 1
- `contact_profile_about`
string (16777215)
- `contact_signature`
string (255)
- `contact_page_registered`
string (255)
- `contact_referrer_type_id`
int (11)
- `contact_referrer_type_detail_id`
int unsigned (10)
- `contact_referrer_url`
string (255)
- `contact_referrer_text`
string (255)
- `contact_screen_width`
int
- `contact_screen_height`
int
- `contact_privacy_email_unsubscribed`
0 or 1
- `contact_privacy_no_online_status`
0 or 1
- `contact_privacy_no_contact_messages`
0 or 1
- `language_id`
string (5)
- `affiliate_id`
int unsigned (10)
- `affiliate_date`
date