Visitor
Visitor PHP Methods
add(array $fieldValues) v5
Adds a new record.
PARAMETERS:
$fieldValues = Array of the values for each column when adding the record (Associative array with key = field name & value = field value).
RETURN VALUE:
int = id of the new record.
0 = if fails canViewEmail(string $vEmail) v5
Checks if the visitor can view emails
PARAMETERS:
$vEmail = string, email address
RETURN VALUE:
bool = true if the visitor can view the email, false otherwise checkLoaded() v5
Checks if record is loaded. throwing an error if the record failed to load successfully.
PARAMETERS:
NONE
RETURN VALUE:
VOID contact() v5
Gets visitor contact as an object
PARAMETERS:
NONE
RETURN VALUE:
object = visitor contact as an object convertHTML(string $htmlContent = "", string $prefix = "", bool $urlEncode = false) v5
Converts ~~ variables in the $htmlContent that is provided and returns the converted content. The title of the ~~ variables are converted by the content from the column in the database with the matching title.
PARAMETERS:
$htmlContent = String, HTML content body to convert.
$prefix= String, tilde code prefix if any.
$urlEncode = Bool, true if you want to apply URL encode to the content, false otherwise
RETURN VALUE:
String = Converted HTML delete(string $restoreQuery = "") v5
Deletes the loaded record from the database.
PARAMETERS:
$restoreQuery = FOR INTERNAL USE. FOR TYPICAL USAGE LEAVE THIS BLANK. The restore query to pass along when deleting an object with dependencies.
RETURN VALUE:
VOID deleteDuplicateIDs(array $idArr, \WMT\Access\Tools $accessTools) v5
Delete duplicate visitors
PARAMETERS:
$idArr = array, duplicate visitor IDs
$accessTools = object
RETURN VALUE:
VOID deleteDuplicates(\WMT\Access\Tools $accessTools) v5
Delete duplicate visitors
PARAMETERS:
$accessTools = object
RETURN VALUE:
VOID duplicate(array $newValues = null) v5
Creates a duplicate record in the database of the current object
PARAMETERS:
$newValues = array, associative array with field name as key and field value as array value containing the new values if any
RETURN VALUE:
int = the id of the new record. entity() v5
Loads a member object or contact object based on visitor type
PARAMETERS:
NONE
RETURN VALUE:
Object = member or contact object function load(string $queryWhere) v5
Loads values for the record matching the criteria specified by $queryWhere. If the there is more than one record returned from the query then only the first record is loaded.
PARAMETERS:
$queryWhere = String, SQL where query.
RETURN VALUE:
Bool = true, if success, false otherwise getContactID() v5
Gets visitor contact ID
PARAMETERS:
NONE
RETURN VALUE:
int = contact ID getDatabaseName() v5
Returns object's database table name
PARAMETERS:
NONE
RETURN VALUE:
String = Database name getDefaultTRHTML() v5
Returns the default html code for a tr row with all of the fields from the database in it as ~~ vars
PARAMETERS:
NONE
RETURN VALUE:
String = the default HTML code for a tr row with all of the fields from the database in it as ~~ vars getEntitiesArr(string $contactHTML, string $memberHTML) v5
Gets visitor details as an array including member/contact details
PARAMETERS:
$contactHTML = string, contact HTML template to show the results
$memberHTML = string, member HTML template to show the results
RETURN VALUE:
string = visitor details as an array including member/contact details as HTML using the HTML template getFirstVisitTimestamp() v5
Gets visitor first visit time as timestamp
PARAMETERS:
NONE
RETURN VALUE:
int = visitor first visit time as timestamp getID() v5
Sets object ID
PARAMETERS:
NONE
RETURN VALUE:
int = ID getJSON(bool $returnArr = false) v5
Get JSON array for the loaded record.
PARAMETERS:
Bool = true if want to return JSON, false otherwise
RETURN VALUE:
Object Array or JSON encoded version of the array getLastVisitTimestamp() v5
Gets visitor last visit time as timestamp
PARAMETERS:
NONE
RETURN VALUE:
int = visitor last visit time as timestamp getMemberID() v5
Gets visitor member ID
PARAMETERS:
NONE
RETURN VALUE:
int = member ID getName() v5
Gets visitor name; contact name or member name
PARAMETERS:
NONE
RETURN VALUE:
string = visitor name as HTML with action dropdown; either member action dropdown if the visitor is a member or contact dropdown if the visitor is contact getReferrerID() v5
Gets visitor referrer member ID
PARAMETERS:
NONE
RETURN VALUE:
int = referrer member ID getStatsArr() v5
Gets visitor first, last visit details and number of visits stats as an array
PARAMETERS:
NONE
RETURN VALUE:
array = visitor first, last visit details and number of visits stats as an array getTotalVisits() v5
Gets visitor total number of visits
PARAMETERS:
NONE
RETURN VALUE:
int = visitor total number of visits getUser() v5
Gets member object for visitor if the visitor is logged in, else returns contact object if there's a contact created for this visitor
PARAMETERS:
NONE
RETURN VALUE:
object = member object for visitor if the visitor is logged in, else returns contact object if there's a contact created for this visitor getValue(string $fieldName = "value") v5
Returns the value from a specific column for this record.
PARAMETERS:
$fieldName = String, field name.
RETURN VALUE:
Field value hasField(string $fieldName) v5
Checks if the field shown or hidden
PARAMETERS:
$fieldName= String, Field title.
RETURN VALUE:
Bool= True if the field show is true, false otherwise hideAllFields() v5
hides all fields(columns)
PARAMETERS:
NONE
RETURN VALUE:
VOID hideField($fieldTitle) v5
Hides specific field title by its column title
PARAMETERS:
$fieldTitle = String, Field title.
RETURN VALUE:
VOID isEmailConfirmed() v5
Checks if the visitor confirmed his email
PARAMETERS:
NONE
RETURN VALUE:
bool = true if the visitor confirmed his email as member or contact, false otherwise isLoaded() v5
Checks if an object is loaded correctly (can be used to check if ID exists).
PARAMETERS:
NONE
RETURN VALUE:
Bool = True if the object loaded successfully, false otherwise isMember() v5
Checks if the visitor is a member or not
PARAMETERS:
NONE
RETURN VALUE:
bool = true of the visitor is a member, false otherwise isPhoneConfirmed() v5
Checks if the visitor confirmed his phone number
PARAMETERS:
NONE
RETURN VALUE:
bool = true if the visitor confirmed his phone number as member or contact, false otherwise loadFirstID() v5
Get object's first id
PARAMETERS:
NONE
RETURN VALUE:
int = First ID loadID(int $id) v5
Loads values for the record with the id specified.
PARAMETERS:
$id = int, record ID.
RETURN VALUE:
Bool = true, if success, false otherwise loadMember(int $memberID) v5
Load a member using member ID
PARAMETERS:
$memberID = int, Member ID
RETURN VALUE:
VOID member() v5
Gets visitor member as an object
PARAMETERS:
NONE
RETURN VALUE:
object = visitor member as an object provideContainer(\WMT\Container $container) v5
Sets container object
PARAMETERS:
$container = Object
RETURN VALUE:
VOID referrer() v5
Gets visitor referrer as an object
PARAMETERS:
NONE
RETURN VALUE:
object = visitor referrer as an object save(array $fieldValues) v5
Saves the record with the new values specified in the $fieldValuesarray.
PARAMETERS:
$fieldValues = Array of the values for each column when adding the record (Associative array with key = field name & value = field value).
RETURN VALUE:
Bool = True on success, False otherwise. setContactID(int $contactID) v5
Sets contact ID for the loaded visitor
PARAMETERS:
$contactID = int, contact ID
RETURN VALUE:
VOID setContactNotFoundRedirectLogin(bool $doRedirect = true) v5
Turn redirect if the visitor is not found to be a contact on/off
PARAMETERS:
$doRedirect = bool, true to turn on redirect if contact not found, false otherwise
RETURN VALUE:
VOID setMemberID(int $memberID) v5
Sets member ID for the loaded visitor
PARAMETERS:
$memberID = int, member ID
RETURN VALUE:
VOID setMemberNotFoundRedirectLogin(bool $doRedirect = true) v5
Turn redirect if the visitor is not found to be a member on/off
PARAMETERS:
$doRedirect = bool, true to turn on redirect if member not found, false otherwise
RETURN VALUE:
VOID setMyMemberID(int $memberID) v5
Sets member's ID
PARAMETERS:
$memberID = int, member id
RETURN VALUE:
VOID setRestoreID(int $id) v5
Sets restor point ID
PARAMETERS:
$id = int, restore ID
RETURN VALUE:
VOID settingHTTPS(bool $useHTTPS = true) v5
Sets site to use https or http
PARAMETERS:
$useHTTPS = True if https on, false otherwise (default true).
RETURN VALUE:
VOID settingSiteURL(string $siteURL) v5
Sets Site Domain
PARAMETERS:
$siteURL = String, site URL
RETURN VALUE:
VOID showAllFields() v5
Show all fields(columns)
PARAMETERS:
NONE
RETURN VALUE:
VOID showField($fieldTitle) v5
Shows specific field title by its column title
PARAMETERS:
$fieldTitle = String, Field title.
RETURN VALUE:
VOIDVisitor PHP Variables
🔎︎ %l4610%
Columns in the visitors Database Table:
id contact member referrer added
Code Example
Use the code below to
view a record in an
html page:
Use the code below to
add a record:
Use the code below to
delete a record: