Customer
extends User
in package
Customer as used in the Shop.
Extends the User class
Tags
Table of Contents
Properties
- $arrAttributeHistories : mixed
- $arrNoAvatar : array<string|int, mixed>
- $arrNoPicture : mixed
- $arrUpdatedAttributeHistories : mixed
- $EOF : mixed
- $error_msg : string
- Contains the message if an error occurs
- $objAttribute : User_Profile_Attribute
- $arrCachedUsers : array<string|int, mixed>
- Array that holds all users which were ever loaded
- $arrLoadedUsers : array<string|int, mixed>
- Array which holds all loaded users for later usage
- $auth_token : string
- Token used for auto login
- $auth_token_timeout : int
- Timeout used for auto login
- $defaultHashAlgorithm : string
- Contains the default hash algorithm to be used for password generation
- $id : int
- ID of loaded user
- $password : string
- Password of user
- $verified : bool
- verification status of user
- $arrAttributes : mixed
- $arrGroups : array<string|int, mixed>
- Contains an array of all group IDS which the user is associated to
- $arrNewsletterListIDs : array<string|int, mixed>
- Contains an array of all newsletter-list-IDs of which the user has a subscription of
- $arrPrivacyAccessTypes : mixed
- $backend_language : int
- Language ID used for the backend
- $defaultEmailAccessType : mixed
- $defaultProfileAccessTyp : mixed
- $email : string
- E-Mail address of user
- $email_access : bool
- Determines who is allowed to see the user's e-mail address
- $expiration : int
- Expiration date of the account (timestamp)
- $filtered_search_count : int
- Contains the number of currently loaded users
- $frontend_language : int
- Language ID used for the frontend
- $is_active : bool
- Active status of user
- $is_admin : bool
- Administrator status
- $lang_id : int
- Language ID of user
- $last_activity : int
- The last time that the user was active (timestamp)
- $last_auth : int
- The last time the user had logged in (timestamp)
- $loggedIn : bool
- TRUE if user is authenticated
- $primary_group : int
- The ID of a user group that should be used as the primary one
- $profile_access : string
- Determines who is allowed to see the user's profile data.
- $regdate : int
- Registration date of user (timestamp)
- $restore_key : string
- Key which will be used to reset the password
- $restore_key_time : int
- Date as timestamp when a new password was requested
- $username : string
- Username of user
- $validity : int
- Validity time period
Methods
- __clone() : mixed
- __construct() : Customer
- Creates a Customer
- active() : bool
- Get or set the active status
- address() : string
- Get or set the address
- auth() : bool
- Authenticate user against username and password
- authByToken() : mixed
- checkAuthToken() : mixed
- checkLoginData() : mixed
- Checks username, password and captcha.
- checkMandatoryCompliance() : mixed
- checkPassword() : bool
- Returns TRUE if the given password matches the current user, FALSE otherwise.
- city() : string
- Get or set the city name
- clearCache() : mixed
- Clears the cache
- company() : string
- Get or set the company name
- companynote() : string
- Get or set the company note
- country_id() : int
- Get or set the country ID
- delete() : bool
- Delete this Customer from the database
- email() : string
- Get or set the e-mail address
- errorHandler() : bool
- Handles database errors
- fax() : string
- Get or set the fax number
- finishSignUp() : mixed
- first() : mixed
- Load first user
- firstname() : string
- Get or set the first name
- forceDefaultEmailAccess() : mixed
- forceDefaultProfileAccess() : mixed
- gender() : string
- Get or set the gender
- generateAuthToken() : mixed
- getActiveStatus() : mixed
- getAdminStatus() : mixed
- getAssociatedGroupIds() : array<string|int, mixed>
- Returns an array containing the ids of the user's associated groups
- getBackendLanguage() : mixed
- getById() : Customer
- Select a Customer by ID from the database.
- getCrmUserId() : int|null
- Checks whether the user account is connected with a crm customer
- getDynamicPermissionIds() : mixed
- getEmail() : mixed
- getEmailAccess() : mixed
- getErrorMsg() : mixed
- getExpirationDate() : mixed
- getFilteredSearchUserCount() : mixed
- getFrontendLanguage() : mixed
- getGenderMenu() : string
- Returns the HTML dropdown menu code for selecting the gender/title
- getHashedPassword() : string
- Returns the hash of the newly set password of the user account if it has been changed.
- getId() : mixed
- getLastActivityTime() : mixed
- getLastAuthenticationTime() : mixed
- getName() : string
- Returns a string representing the name of this customer
- getPrimaryGroupId() : mixed
- getPrimaryGroupName() : mixed
- getPrivacyAccessMenu() : mixed
- getProfileAccess() : mixed
- getProfileAttribute() : mixed
- getRealUsername() : mixed
- getRegisteredByEmail() : User
- Returns the registered Customer with the given e-mail address
- getRegistrationDate() : mixed
- getRestoreKey() : mixed
- getRestoreKeyTime() : mixed
- getStaticPermissionIds() : mixed
- getSubscribedNewsletterListIDs() : array<string|int, mixed>
- Returns an array of all newsletter-list-IDs the user did subscribe to
- getSubstitutionArray() : array<string|int, mixed>
- Returns an array of Customer data for MailTemplate substitution
- getTimezone() : DateTimeZone
- Returns this user's timezone
- getUnregisteredByEmail() : User
- Returns the unregistered Customer with the given e-mail address
- getUser() : mixed
- Fetch instance of User specified by ID $id.
- getUsername() : mixed
- getUsers() : Customer
- Returns a Customer object according to the given criteria
- getValidityTimePeriod() : mixed
- group_id() : int
- Get or set the Customer group ID
- hashPassword() : string
- Generate hash of password with default hash algorithm
- hasModeAccess() : mixed
- id() : int
- Get the ID
- is_reseller() : bool
- Get or set the reseller status
- isAllowedToChangeEmailAccess() : mixed
- isAllowedToChangeProfileAccess() : mixed
- isAllowedToDeleteAccount() : mixed
- isLoggedIn() : bool
- Returns true if the User is logged in
- isUniqueEmail() : bool
- Returns true if $email is a unique e-mail address in the system
- isValidPassword() : bool
- Returns true if the given $password is valid
- isValidUsername() : bool
- Returns true if the given $username is valid
- isVerified() : mixed
- lastname() : string
- Get or set the last name
- login() : mixed
- make_password() : string
- Return a valid password
- make_username() : string
- Tries to form a valid and unique username from the words given
- next() : mixed
- Load next user
- phone() : string
- Get or set the phone number
- register_date() : bool
- Get or set the register date
- registerFailedLogin() : mixed
- Register a failed login.
- registerSuccessfulLogin() : mixed
- Register a successful login.
- releaseRestoreKey() : mixed
- reset() : mixed
- set_active() : void
- Set the active status of one or more Users
- setActiveStatus() : void
- Set active status of user
- setAdminStatus() : bool
- Set administration status of user
- setAuthToken() : mixed
- setBackendLanguage() : void
- Set backend language ID of user
- setEmail() : bool
- Sets email address of user
- setEmailAccess() : mixed
- setExpirationDate() : mixed
- setFrontendLanguage() : void
- Set frontend language ID of user
- setGroups() : void
- Set ID's of groups to which this user should belong to
- setHashedPassword() : mixed
- Set new password as hash of password
- setPassword() : bool
- Sets password of user
- setPrimaryGroup() : void
- Set the Id of a user group that should be used as the user's primary group
- setProfile() : mixed
- setProfileAccess() : mixed
- setRestoreKey() : mixed
- Set the restore-key
- setRestoreKeyTime() : mixed
- Set the restore-key validity timeout
- setSubscribedNewsletterListIDs() : void
- Set ID's of newsletter-list the which the user subscribed to
- setUsername() : bool
- Sets username of user
- setValidityTimePeriod() : bool
- Sets the validity period of the account
- setVerification() : bool
- Set verification status of user
- signUp() : mixed
- store() : bool
- Store user account
- toArray() : mixed
- Get object data as array
- updatePassword() : bool
- Updates the password of the Customer with the given e-mail address
- username() : string
- Get or set the user name
- validateEmail() : bool
- Returns true if this Users' e-mail address is valid and unique.
- validateUsername() : bool
- Returns true if the User name is valid and unique
- zip() : string
- Get or set the zip code
- createProfile() : bool
- Create a profile for the loaded user
- createUser() : mixed
- fetchPasswordHashFromDatabase() : string
- Fetch the password hash of the currently loaded user from the database
- isUniqueUsername() : bool
- Returns true if $username is a unique user name
- loadCustomAttributeProfileData() : bool
- Load custom attribute profile data
- loadUsers() : mixed
- parseAttributeSearchConditions() : array<string|int, mixed>
- Enter description here... Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match.
- parseCoreAttributeFilterConditions() : array<string|int, mixed>
- Parse core attribute filter conditions
- parseCustomAttributeFilterConditions() : array<string|int, mixed>
- Parse custom attribute filter conditions
- parseFilterConditions() : array<string|int, mixed>
- Parse and translate an array of filter rules into SQL statements to be used for filtering users.
- randomChar() : string
- Return a random character picked from the given string
- sendUserAccountInvitationMail() : mixed
- Send a invitation mail to the created user.
- storeProfile() : mixed
- updateLoadedUserData() : mixed
- Update a specific profile attribute of the user
- updatePasswordHash() : mixed
- Verify that the password is properly hashed
- updateUser() : mixed
- clean() : mixed
- Clean user metadata
- getFilteredUserIdList() : mixed
- getShopUserEmail() : string
- Returns the e-mail address if the User accounts has been created by the Shop.
- initAttributes() : mixed
- isLastAdmin() : bool
- Returns true if the current User has the only active admin account present in the system.
- load() : bool
- Load user data
- loadGroups() : mixed
- Load group ID's of user
- loadPermissionIds() : mixed
- loadSubscribedNewsletterListIDs() : mixed
- parseAccountFilterConditions() : array<string|int, mixed>
- Parse account filter conditions
- parseAccountSearchConditions() : array<string|int, mixed>
- Creates the SQL query snippet to match username (and e-mail in the backend) fields against the search term(s)
- removeOutdatedAccounts() : mixed
- setSortedUserIdList() : mixed
- storeGroupAssociations() : bool
- Store group associations
- storeNewsletterSubscriptions() : bool
- Store the user's newsletter-list-subscriptions to the database
- updateLastActivityTime() : mixed
- updateLastAuthTime() : mixed
- validateLanguageId() : mixed
- Validate language id
Properties
$arrAttributeHistories
public
mixed
$arrAttributeHistories
$arrNoAvatar
public
static array<string|int, mixed>
$arrNoAvatar
= array('src' => '0_noavatar.gif', 'width' => 121, 'height' => 160)
Tags
$arrNoPicture
public
static mixed
$arrNoPicture
= array('src' => '0_no_picture.gif', 'width' => 80, 'height' => 84)
$arrUpdatedAttributeHistories
public
mixed
$arrUpdatedAttributeHistories
$EOF
public
mixed
$EOF
Tags
$error_msg
Contains the message if an error occurs
public
string
$error_msg
= array()
$objAttribute
public
User_Profile_Attribute
$objAttribute
$arrCachedUsers
Array that holds all users which were ever loaded
protected
array<string|int, mixed>
$arrCachedUsers
= array()
Tags
$arrLoadedUsers
Array which holds all loaded users for later usage
protected
array<string|int, mixed>
$arrLoadedUsers
= array()
Tags
$auth_token
Token used for auto login
protected
string
$auth_token
$auth_token_timeout
Timeout used for auto login
protected
int
$auth_token_timeout
$defaultHashAlgorithm
Contains the default hash algorithm to be used for password generation
protected
string
$defaultHashAlgorithm
$id
ID of loaded user
protected
int
$id
Tags
$password
Password of user
protected
string
$password
Tags
$verified
verification status of user
protected
bool
$verified
$arrAttributes
private
mixed
$arrAttributes
= array('id' => 'int', 'is_admin' => 'int', 'username' => 'string', 'regdate' => 'int', 'expiration' => 'int', 'validity' => 'int', 'last_auth' => 'int', 'last_activity' => 'int', 'primary_group' => 'int', 'email' => 'string', 'email_access' => 'string', 'frontend_lang_id' => 'int', 'backend_lang_id' => 'int', 'active' => 'int', 'verified' => 'int', 'profile_access' => 'string', 'restore_key' => 'string', 'restore_key_time' => 'int')
Tags
$arrGroups
Contains an array of all group IDS which the user is associated to
private
array<string|int, mixed>
$arrGroups
Tags
$arrNewsletterListIDs
Contains an array of all newsletter-list-IDs of which the user has a subscription of
private
array<string|int, mixed>
$arrNewsletterListIDs
= array()
Tags
$arrPrivacyAccessTypes
private
mixed
$arrPrivacyAccessTypes
= array('everyone' => array('email' => 'TXT_ACCESS_EVERYONE_ALLOWED_SEEING_EMAIL', 'profile' => 'TXT_ACCESS_EVERYONE_ALLOWED_SEEING_PROFILE'), 'members_only' => array('email' => 'TXT_ACCESS_MEMBERS_ONLY_ALLOWED_SEEING_EMAIL', 'profile' => 'TXT_ACCESS_MEMBERS_ONLY_ALLOWED_SEEING_PROFILE'), 'nobody' => array('email' => 'TXT_ACCESS_NOBODY_ALLOWED_SEEING_EMAIL', 'profile' => 'TXT_ACCESS_NOBODY_ALLOWED_SEEING_PROFILE'))
Tags
$backend_language
Language ID used for the backend
private
int
$backend_language
Tags
$defaultEmailAccessType
private
mixed
$defaultEmailAccessType
Tags
$defaultProfileAccessTyp
private
mixed
$defaultProfileAccessTyp
Tags
E-Mail address of user
private
string
$email
Tags
$email_access
Determines who is allowed to see the user's e-mail address
private
bool
$email_access
Tags
$expiration
Expiration date of the account (timestamp)
private
int
$expiration
Tags
$filtered_search_count
Contains the number of currently loaded users
private
int
$filtered_search_count
= 0
Tags
$frontend_language
Language ID used for the frontend
private
int
$frontend_language
Tags
$is_active
Active status of user
private
bool
$is_active
Tags
$is_admin
Administrator status
private
bool
$is_admin
Tags
$lang_id
Language ID of user
private
int
$lang_id
Tags
$last_activity
The last time that the user was active (timestamp)
private
int
$last_activity
Tags
$last_auth
The last time the user had logged in (timestamp)
private
int
$last_auth
Tags
$loggedIn
TRUE if user is authenticated
private
bool
$loggedIn
If this is TRUE the methods and will be looked for further usage.
Tags
$primary_group
The ID of a user group that should be used as the primary one
private
int
$primary_group
Tags
$profile_access
Determines who is allowed to see the user's profile data.
private
string
$profile_access
Tags
$regdate
Registration date of user (timestamp)
private
int
$regdate
Tags
$restore_key
Key which will be used to reset the password
private
string
$restore_key
Tags
$restore_key_time
Date as timestamp when a new password was requested
private
int
$restore_key_time
Tags
$username
Username of user
private
string
$username
Tags
$validity
Validity time period
private
int
$validity
This integer represents the expiration of the user. A user won't be able to authenticate again after his validity time period has exceeded. A validity time period of zero mean that the account has no expiration date.
Tags
Methods
__clone()
public
__clone() : mixed
__construct()
Creates a Customer
public
__construct() : Customer
Tags
Return values
Customer —The Customer
active()
Get or set the active status
public
active([bool $active = null ]) : bool
Parameters
- $active : bool = null
-
The optional active status
Tags
Return values
bool —True if the customer is active, false otherwise.
address()
Get or set the address
public
address([string $address = null ]) : string
Parameters
- $address : string = null
-
The optional address (street and number)
Tags
Return values
string —The address (street and number)
auth()
Authenticate user against username and password
public
auth(string $username, string $password[, bool $backend = false ][, mixed $captchaCheckResult = false ]) : bool
Verifies the password of a username within the database. If the password matches the appropriate users gets loaded and the users last authentication time gets updated. Returns TRUE on success or FALSE on failure.
Parameters
- $username : string
-
The username
- $password : string
-
The raw password
- $backend : bool = false
-
Tries to authenticate for the backend if true, false otherwise
- $captchaCheckResult : mixed = false
Return values
bool —True on success, false otherwise
authByToken()
public
authByToken(mixed $userId, mixed $authToken[, mixed $backend = false ]) : mixed
Parameters
- $userId : mixed
- $authToken : mixed
- $backend : mixed = false
checkAuthToken()
public
checkAuthToken(mixed $userId, mixed $authToken) : mixed
Parameters
- $userId : mixed
- $authToken : mixed
checkLoginData()
Checks username, password and captcha.
public
checkLoginData(string $username, string $password[, bool $captchaCheckResult = false ]) : mixed
Parameters
- $username : string
- $password : string
- $captchaCheckResult : bool = false
Return values
mixed —false or user id
checkMandatoryCompliance()
public
checkMandatoryCompliance() : mixed
checkPassword()
Returns TRUE if the given password matches the current user, FALSE otherwise.
public
checkPassword(string $password[, string $passwordHash = '' ]) : bool
Parameters
- $password : string
-
Raw password to be verified
- $passwordHash : string = ''
-
The hash of the password to verify the supplied password with. If not supplied, it will be fetched from the database.
Return values
boolcity()
Get or set the city name
public
city([string $city = null ]) : string
Parameters
- $city : string = null
-
The optional city name
Tags
Return values
string —The city name
clearCache()
Clears the cache
public
clearCache() : mixed
Only use this when loading lots of users (export)!
company()
Get or set the company name
public
company([string $company = null ]) : string
Parameters
- $company : string = null
-
The optional company name
Tags
Return values
string —The company name
companynote()
Get or set the company note
public
companynote([string $companynote = null ]) : string
Parameters
- $companynote : string = null
-
The optional company note
Tags
Return values
string —The company note
country_id()
Get or set the country ID
public
country_id([int $country_id = null ]) : int
Parameters
- $country_id : int = null
-
The optional Country ID
Tags
Return values
int —The Country ID
delete()
Delete this Customer from the database
public
delete([mixed $deleteOwnAccount = false ]) : bool
Also deletes all of her orders
Parameters
- $deleteOwnAccount : mixed = false
Tags
Return values
bool —True on success, false otherwise
email()
Get or set the e-mail address
public
email([string $email = null ]) : string
Parameters
- $email : string = null
-
The optional e-mail address
Tags
Return values
string —The e-mail address
errorHandler()
Handles database errors
public
static errorHandler() : bool
Also migrates old Shop Customers to the User accounts and adds all new settings
Tags
Return values
bool —false Always!
fax()
Get or set the fax number
public
fax([string $phone_fax = null ]) : string
Parameters
- $phone_fax : string = null
-
The optional fax number
Tags
Return values
string —The fax number
finishSignUp()
public
finishSignUp() : mixed
first()
Load first user
public
first() : mixed
firstname()
Get or set the first name
public
firstname([string $firstname = null ]) : string
Parameters
- $firstname : string = null
-
The optional first name
Tags
Return values
string —The first name
forceDefaultEmailAccess()
public
static forceDefaultEmailAccess() : mixed
forceDefaultProfileAccess()
public
static forceDefaultProfileAccess() : mixed
gender()
Get or set the gender
public
gender([string $gender = null ]) : string
Parameters
- $gender : string = null
-
The optional gender
Tags
Return values
string —The gender
generateAuthToken()
public
generateAuthToken() : mixed
getActiveStatus()
public
getActiveStatus() : mixed
getAdminStatus()
public
getAdminStatus() : mixed
getAssociatedGroupIds()
Returns an array containing the ids of the user's associated groups
public
getAssociatedGroupIds([bool $activeOnly = false ]) : array<string|int, mixed>
Parameters
- $activeOnly : bool = false
-
Wether to load only the active groups or all
Return values
array<string|int, mixed>getBackendLanguage()
public
getBackendLanguage() : mixed
getById()
Select a Customer by ID from the database.
public
static getById(int $id) : Customer
Parameters
- $id : int
-
The Customer ID
Tags
Return values
Customer —The Customer object on success, null otherwise
getCrmUserId()
Checks whether the user account is connected with a crm customer
public
getCrmUserId() : int|null
Return values
int|null —id of crm user if the user is associated with a customer of crm module
getDynamicPermissionIds()
public
getDynamicPermissionIds([mixed $reload = false ]) : mixed
Parameters
- $reload : mixed = false
getEmail()
public
getEmail() : mixed
getEmailAccess()
public
getEmailAccess() : mixed
getErrorMsg()
public
getErrorMsg() : mixed
getExpirationDate()
public
getExpirationDate() : mixed
getFilteredSearchUserCount()
public
getFilteredSearchUserCount() : mixed
getFrontendLanguage()
public
getFrontendLanguage() : mixed
getGenderMenu()
Returns the HTML dropdown menu code for selecting the gender/title
public
static getGenderMenu(string $selected[, string $name = 'gender' ]) : string
Parameters
- $selected : string
-
The optional select tag name attribute value. Defaults to 'shipPrefix'
- $name : string = 'gender'
-
The optional
Tags
Return values
string —The HTML menu code
getHashedPassword()
Returns the hash of the newly set password of the user account if it has been changed.
public
getHashedPassword() : string
This method only returns the password (its hash) of the user account in case it has been changed using User::setPassword(). This method's purpose is to have the newly set password (its hash) available in the model events through it.
Return values
string —The newly set password of the user account
getId()
public
getId() : mixed
getLastActivityTime()
public
getLastActivityTime() : mixed
getLastAuthenticationTime()
public
getLastAuthenticationTime() : mixed
getName()
Returns a string representing the name of this customer
public
getName([string $format = null ]) : string
The format of the string is determined by the optional $format parameter in sprintf() format:
- %1$u : ID
- %2$s : Company
- %3$s : First name
- %4$s : Last name Defaults to '%2$s %3$s %4$s (%1$u)'. The result is trimmed before it is returned.
Parameters
- $format : string = null
-
The optional format string
Return values
string —The Customer name
getPrimaryGroupId()
public
getPrimaryGroupId() : mixed
getPrimaryGroupName()
public
getPrimaryGroupName() : mixed
getPrivacyAccessMenu()
public
getPrivacyAccessMenu(mixed $attrs, mixed $option) : mixed
Parameters
- $attrs : mixed
- $option : mixed
getProfileAccess()
public
getProfileAccess() : mixed
getProfileAttribute()
public
getProfileAttribute(mixed $attributeId[, mixed $historyId = 0 ]) : mixed
Parameters
- $attributeId : mixed
- $historyId : mixed = 0
getRealUsername()
public
getRealUsername() : mixed
getRegisteredByEmail()
Returns the registered Customer with the given e-mail address
public
static getRegisteredByEmail(string $email) : User
Parameters
- $email : string
-
The e-mail address
Tags
Return values
User —The Customer on success, null otherwise
getRegistrationDate()
public
getRegistrationDate() : mixed
getRestoreKey()
public
getRestoreKey() : mixed
getRestoreKeyTime()
public
getRestoreKeyTime() : mixed
getStaticPermissionIds()
public
getStaticPermissionIds([mixed $reload = false ]) : mixed
Parameters
- $reload : mixed = false
getSubscribedNewsletterListIDs()
Returns an array of all newsletter-list-IDs the user did subscribe to
public
getSubscribedNewsletterListIDs() : array<string|int, mixed>
Return values
array<string|int, mixed> —Newsletter-list-IDs
getSubstitutionArray()
Returns an array of Customer data for MailTemplate substitution
public
getSubstitutionArray() : array<string|int, mixed>
The password is no longer available in the session if the confirmation is sent after paying with some external PSP that uses some form of instant payment notification (i.e. PayPal)! In that case, it is NOT included in the template produced. Call Shop::sendLogin() while processing the Order instead.
Tags
Return values
array<string|int, mixed> —The Customer data substitution array
getTimezone()
Returns this user's timezone
public
getTimezone() : DateTimeZone
Tags
Return values
DateTimeZone —User's timezone
getUnregisteredByEmail()
Returns the unregistered Customer with the given e-mail address
public
static getUnregisteredByEmail(string $email) : User
Note the implicit contradiction. Even unregistered Customers are stored in the database and retrieved when they visit the Shop again. However, such Users are always inactive, and thus cannot log in. They are identified by their e-mail address and updated with the current data. That information is needed for processing the order and sending confirmation e-mails. Note that this kind of Customer is limited to the group of final customers. This implies that no reseller prices are available to unregistered Customers. A true unregistered customer is identified as follows:
- No administrator: User::getAdminStatus() = false
- Never signed-in (this is important to distinguish from an account that has been disabled by an administrator): User::getLastAuthenticationTime() = 0
- No activity logged (this is important to distinguish from an account that has been disabled by an administrator) User::getLastActivityTime() = 0
- Account is verified: User::isVerified() = 1
- Account is disabled: User::getActiveStatus() = 0
- Account has made at least one order
- Account is only a member of the shop customer group: User::getAssociatedGroupIds() === [usergroup_id_customer]
Parameters
- $email : string
-
The e-mail address
Return values
User —The Customer on success, null otherwise
getUser()
Fetch instance of User specified by ID $id.
public
getUser(int $id[, bool $forceReload = false ]) : mixed
Parameters
- $id : int
-
The ID of the user to fetch
- $forceReload : bool = false
-
Set to TRUE to refetch the user from the database. Otherwise, the user will be loaded from cache, in case it has been loaded before. Defaults to FALSE.
Return values
mixed —Instance of \User if successful. Otherwise FALSE.
getUsername()
public
getUsername() : mixed
getUsers()
Returns a Customer object according to the given criteria
public
getUsers([array<string|int, mixed> $filter = null ][, string $search = null ][, array<string|int, mixed> $arrSort = null ][, array<string|int, mixed> $arrAttributes = null ][, int $limit = null ][, int $offset = 0 ]) : Customer
This extends the parent method by resolving the "group" index in the $filter array to User IDs. These are in turn passed to the User class.
Parameters
- $filter : array<string|int, mixed> = null
- $search : string = null
- $arrSort : array<string|int, mixed> = null
- $arrAttributes : array<string|int, mixed> = null
- $limit : int = null
- $offset : int = 0
Return values
Customer —The Customer object on success, false otherwise
getValidityTimePeriod()
public
getValidityTimePeriod() : mixed
group_id()
Get or set the Customer group ID
public
group_id([int $group_id = null ]) : int
Parameters
- $group_id : int = null
-
The optional group ID
Tags
Return values
int —The group ID
hashPassword()
Generate hash of password with default hash algorithm
public
hashPassword(string $password) : string
Parameters
- $password : string
-
Password to be hashed
Tags
Return values
string —The generated hash of the supplied password
hasModeAccess()
public
hasModeAccess([mixed $backend = false ]) : mixed
Parameters
- $backend : mixed = false
id()
Get the ID
public
id() : int
Tags
Return values
int —$id Customer ID
is_reseller()
Get or set the reseller status
public
is_reseller([bool $is_reseller = null ]) : bool
Parameters
- $is_reseller : bool = null
-
The optional reseller status
Tags
Return values
bool —True if the customer is a reseller, false otherwise.
isAllowedToChangeEmailAccess()
public
isAllowedToChangeEmailAccess() : mixed
isAllowedToChangeProfileAccess()
public
isAllowedToChangeProfileAccess() : mixed
isAllowedToDeleteAccount()
public
isAllowedToDeleteAccount() : mixed
isLoggedIn()
Returns true if the User is logged in
public
isLoggedIn() : bool
Return values
bool —True if the User is logged in, false otherwise
isUniqueEmail()
Returns true if $email is a unique e-mail address in the system
public
static isUniqueEmail(string $email[, int $id = 0 ]) : bool
Parameters
- $email : string
- $id : int = 0
Tags
Return values
boolisValidPassword()
Returns true if the given $password is valid
public
static isValidPassword(string $password) : bool
Parameters
- $password : string
Return values
boolisValidUsername()
Returns true if the given $username is valid
public
static isValidUsername(string $username) : bool
Parameters
- $username : string
Tags
Return values
boolisVerified()
public
isVerified() : mixed
lastname()
Get or set the last name
public
lastname([string $lastname = null ]) : string
Parameters
- $lastname : string = null
-
The optional last name
Tags
Return values
string —The last name
login()
public
login([mixed $backend = false ]) : mixed
Parameters
- $backend : mixed = false
make_password()
Return a valid password
public
static make_password([int $length = 8 ][, bool $use_special = false ]) : string
Generated passwords consist of
- at least one lower case letter [qwertzupasdfghjkyxcvbnm],
- at least one upper case letter [QWERTZUPASDFGHJKLYXCVBNM],
- at least one digit [23456789], and
- if required, at least one special character [-+_!?%&]. If $length is less than 6, the length will be 6 characters. If $length is greater than 64, the length will be 64 characters. Returns the empty string if isValidPassword() doesn't accept the result, in order to avoid endless loops. Fix the parameters if that occurs.
Parameters
- $length : int = 8
-
Desired password length. Defaults to 8
- $use_special : bool = false
-
Require at least one special character if true. Defaults to false
Return values
string —The new password
make_username()
Tries to form a valid and unique username from the words given
public
static make_username(mixed $word1, mixed $word2) : string
Usually, you would use first and last names as parameters.
Parameters
- $word1 : mixed
- $word2 : mixed
Return values
string —The new user name on success, false otherwise
next()
Load next user
public
next() : mixed
phone()
Get or set the phone number
public
phone([string $phone_private = null ]) : string
Parameters
- $phone_private : string = null
-
The optional phone number
Tags
Return values
string —The phone number
register_date()
Get or set the register date
public
register_date([mixed $regdate = null ]) : bool
Note that this property is not writable in the parent class! However, this is necessary in order to properly migrate old Shop Customers.
Parameters
- $regdate : mixed = null
Tags
Return values
bool —True if the customer is active, false otherwise.
registerFailedLogin()
Register a failed login.
public
static registerFailedLogin(string $username) : mixed
This causes that the user needs to fill out the captcha the next time he logs on.
Parameters
- $username : string
Tags
registerSuccessfulLogin()
Register a successful login.
public
registerSuccessfulLogin() : mixed
Tags
releaseRestoreKey()
public
releaseRestoreKey() : mixed
reset()
public
reset() : mixed
set_active()
Set the active status of one or more Users
public
static set_active(mixed $mix_user_id, bool $active) : void
The $mix_user_id parameter may either be a user ID or an array thereof. Sets appropriate messages.
Parameters
- $mix_user_id : mixed
-
The User ID or an array of those
- $active : bool
-
Activate (true) or deactivate (false) the User(s).
setActiveStatus()
Set active status of user
public
setActiveStatus(bool $status) : void
This will set the attribute is_active of this object either to TRUE or FALSE, depending of $status.
Parameters
- $status : bool
setAdminStatus()
Set administration status of user
public
setAdminStatus(bool $status[, bool $force = false ]) : bool
This will set the attribute is_admin of this object to $status. If $status is FALSE then it will only be accepted if this object isn't the only administrator.
Parameters
- $status : bool
- $force : bool = false
Tags
Return values
boolsetAuthToken()
public
setAuthToken(mixed $authToken) : mixed
Parameters
- $authToken : mixed
setBackendLanguage()
Set backend language ID of user
public
setBackendLanguage(int $langId) : void
This will set the attribute backend_lang_id of this object to $langId.
Parameters
- $langId : int
setEmail()
Sets email address of user
public
setEmail(string $email) : bool
This will set the attribute email of this object to $email if the parameter $email is valid and isn't yet used by an other user.
Parameters
- $email : string
Return values
boolsetEmailAccess()
public
setEmailAccess(mixed $emailAccess) : mixed
Parameters
- $emailAccess : mixed
setExpirationDate()
public
setExpirationDate(mixed $expiration) : mixed
Parameters
- $expiration : mixed
setFrontendLanguage()
Set frontend language ID of user
public
setFrontendLanguage(int $langId) : void
This will set the attribute frontend_lang_id of this object to $langId.
Parameters
- $langId : int
setGroups()
Set ID's of groups to which this user should belong to
public
setGroups(array<string|int, mixed> $arrGroups) : void
Parameters
- $arrGroups : array<string|int, mixed>
Tags
setHashedPassword()
Set new password as hash of password
public
setHashedPassword(string $hashedPassword) : mixed
Parameters
- $hashedPassword : string
-
The hash of the new password to be set
setPassword()
Sets password of user
public
setPassword(string $password[, string $confirmedPassword = null ][, bool $reset = false ][, bool $verify = true ]) : bool
This will set the attribute password of this object to the hash of $password if $password is a valid password and if it was confirmed by the second parameter $confirmedPassword.
Parameters
- $password : string
-
The new password
- $confirmedPassword : string = null
-
The new password, again
- $reset : bool = false
- $verify : bool = true
-
Whether or not to verify if $password is a valid password according to the set password complexity rules.
Tags
Return values
bool —True on success, false otherwise
setPrimaryGroup()
Set the Id of a user group that should be used as the user's primary group
public
setPrimaryGroup(int $groupId) : void
Parameters
- $groupId : int
setProfile()
public
setProfile(mixed $arrProfile[, mixed $ignoreAccessPermissions = false ]) : mixed
Parameters
- $arrProfile : mixed
- $ignoreAccessPermissions : mixed = false
setProfileAccess()
public
setProfileAccess(mixed $profileAccess) : mixed
Parameters
- $profileAccess : mixed
setRestoreKey()
Set the restore-key
public
setRestoreKey([string $restoreKey = null ]) : mixed
The restore-key is used to reset the password or used for the user verification process.
Parameters
- $restoreKey : string = null
-
The restore-key to set. Must be a MD5-hash. If left empty, a new restore-key will be generated.
setRestoreKeyTime()
Set the restore-key validity timeout
public
setRestoreKeyTime(int $seconds[, bool $absolute = false ]) : mixed
Parameters
- $seconds : int
-
Timeout specified in seconds.
- $absolute : bool = false
-
If set to TRUE, the argument $seconds will be interpreted as timestamp instead. Defaults to FALSE.
setSubscribedNewsletterListIDs()
Set ID's of newsletter-list the which the user subscribed to
public
setSubscribedNewsletterListIDs(array<string|int, mixed> $arrNewsletterListIDs) : void
Parameters
- $arrNewsletterListIDs : array<string|int, mixed>
setUsername()
Sets username of user
public
setUsername(string $username) : bool
This will set the attribute username of this object to $username if the parameter $username is valid and isn't yet used by an other user.
Parameters
- $username : string
Return values
boolsetValidityTimePeriod()
Sets the validity period of the account
public
setValidityTimePeriod(mixed $validity) : bool
Administrators cannot be restricted in their validity. Returns TRUE.
Parameters
- $validity : mixed
Return values
boolsetVerification()
Set verification status of user
public
setVerification(bool $verified) : bool
This will set the attribute verified of this object either to TRUE or FALSE, depending of $verified.
Parameters
- $verified : bool
Return values
bool —TRUE
signUp()
public
signUp() : mixed
store()
Store user account
public
store() : bool
This stores the metadata of the user, which includes the username, password, email, language ID, activ status and the administration status, to the database. If it is a new user, it also sets the registration time to the current time.
Tags
Return values
booltoArray()
Get object data as array
public
toArray() : mixed
updatePassword()
Updates the password of the Customer with the given e-mail address
public
static updatePassword(string $email, string $password) : bool
Parameters
- $email : string
-
The e-mail address
- $password : string
-
The new password
Return values
bool —True on success, false otherwise
username()
Get or set the user name
public
username([string $username = null ]) : string
Parameters
- $username : string = null
-
The optional user name
Tags
Return values
string —The user name
validateEmail()
Returns true if this Users' e-mail address is valid and unique.
public
validateEmail() : bool
Otherwise, adds appropriate error messages, and returns false. Required to be public by the Shop!
Return values
bool —True for valid and unique e-mail addresses, false otherwise
validateUsername()
Returns true if the User name is valid and unique
public
validateUsername() : bool
Tags
Return values
bool —True if the User name is valid and unique, false otherwise
zip()
Get or set the zip code
public
zip([string $zip = null ]) : string
Parameters
- $zip : string = null
-
The optional zip code
Tags
Return values
string —The zip code
createProfile()
Create a profile for the loaded user
protected
createProfile() : bool
This creates an entry in the dabase table contrexx_access_user_profile which is related to the entry in the table cotnrexx_access_users of the same user. This methode will be obsolete as soon as we're using InnoDB as storage engine.
Return values
boolcreateUser()
protected
createUser() : mixed
fetchPasswordHashFromDatabase()
Fetch the password hash of the currently loaded user from the database
protected
fetchPasswordHashFromDatabase() : string
Return values
string —Password hash of currently loaded user.
isUniqueUsername()
Returns true if $username is a unique user name
protected
static isUniqueUsername(string $username[, int $id = 0 ]) : bool
Returns false if the test for uniqueness fails, or if the $username exists already. If non-empty, the given User ID is excluded from the search, so the User does not match herself.
Parameters
- $username : string
-
The username to test
- $id : int = 0
-
The optional current User ID
Tags
Return values
bool —True if the username is available, false otherwise
loadCustomAttributeProfileData()
Load custom attribute profile data
protected
loadCustomAttributeProfileData([array<string|int, mixed> $arrAttributes = array() ]) : bool
Gets the data of the custom profile attributes from the database an puts it into the class variables $this->arrLoadedUsers and $this->arrCachedUsers. On the other hand it fills the class variables $this->arrAttributeHistories and $this->arrUpdataedAttributeHistories with the history IDs of each attribute. Returns FALSE if a database error had occurred, otherwise TRUE.
Parameters
- $arrAttributes : array<string|int, mixed> = array()
Return values
boolloadUsers()
protected
loadUsers([mixed $filter = null ][, mixed $search = null ][, mixed $arrSort = null ][, mixed $arrAttributes = null ][, mixed $limit = null ][, mixed $offset = 0 ]) : mixed
Parameters
- $filter : mixed = null
- $search : mixed = null
- $arrSort : mixed = null
- $arrAttributes : mixed = null
- $limit : mixed = null
- $offset : mixed = 0
parseAttributeSearchConditions()
Enter description here... Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match.
protected
parseAttributeSearchConditions(mixed $search[, unknown_type $core = false ][, unknown_type $attributeId = 0 ]) : array<string|int, mixed>
However, if the search parameter is a string and does contain a percent sign already, none will be added to the query. This allows searches using custom patterns, like "fields beginning with "a" ("a%"). (You might even want to extend this to work with arrays, too. Currently, only the shop module uses this feature.) -- RK 20100910
Parameters
- $search : mixed
-
The term or array of terms
- $core : unknown_type = false
- $attributeId : unknown_type = 0
Return values
array<string|int, mixed> —The array of SQL snippets
parseCoreAttributeFilterConditions()
Parse core attribute filter conditions
protected
parseCoreAttributeFilterConditions(array<string|int, mixed> $arrFilter) : array<string|int, mixed>
Generate conditions of the core attributes for the SQL WHERE statement. The filter conditions are defined through the two dimensional array $arrFilter. Each key-value pair represents an attribute and its associated condition to which it must fit to. The condition could either be a integer or string depending on the attributes type, or it could be a collection of integers or strings represented in an array.
Parameters
- $arrFilter : array<string|int, mixed>
Return values
array<string|int, mixed>parseCustomAttributeFilterConditions()
Parse custom attribute filter conditions
protected
parseCustomAttributeFilterConditions(mixed $arrFilter[, string $forceTableIdx = null ][, bool $uniqueJoins = true ][, int &$joinIdx = 0 ]) : array<string|int, mixed>
Generate conditions of the custom attributes for the SQL WHERE statement. The filter conditions are defined through the two dimensional array $arrFilter. Each key-value pair represents an attribute and its associated condition to which it must fit to. The condition could either be a integer or string depending on the attributes type, or it could be a collection of integers or strings represented in an array.
Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match. However, if the search parameter is a string and does contain a percent sign already, none will be added to the query. This allows searches using custom patterns, like "fields beginning with "a" ("a%"). (You might even want to extend this to work with arrays, too. Currently, only the shop module uses this feature.) -- RK 20100910
Parameters
- $arrFilter : mixed
-
The term or array of terms
- $forceTableIdx : string = null
-
Argument must not be used directly. Will internally be used for recursion (parsing child attributes of complex profile attributes like gender or country). If $forceTableIdx is set then its value will be used as prefix for the table alias of the SQL statement.
- $uniqueJoins : bool = true
-
Whether the filter arguments shall be joined by separate unique JOINs or by a single common JOIN statement.
- $joinIdx : int = 0
-
The current index used for separate unique JOINs.
Return values
array<string|int, mixed> —The array of SQL snippets
parseFilterConditions()
Parse and translate an array of filter rules into SQL statements to be used for filtering users.
protected
parseFilterConditions(array<string|int, mixed> $filter, bool &$tblCoreAttributes, bool &$tblGroup, array<string|int, mixed> &$customAttributeJoins, bool &$groupTables[, bool $uniqueJoins = true ][, int &$joinIdx = 0 ]) : array<string|int, mixed>
Parameters
- $filter : array<string|int, mixed>
-
A nested array defining filter rules
- $tblCoreAttributes : bool
-
Will be set to TRUE if the supplied filter arguments $filter will need a join to the core-attribute-table
- $tblGroup : bool
-
Will be set to TRUE if the supplied filter arguments $filter will need a join to the user-group-table
- $customAttributeJoins : array<string|int, mixed>
-
Will be filled with SQL JOIN statements to be used for filtering the custom attributes
- $groupTables : bool
-
Will be set to TRUE if the SQL statement should be grouped (GROUP BY)
- $uniqueJoins : bool = true
-
Whether the filter arguments shall be joined by separate unique JOINs or by a single common JOIN statement.
- $joinIdx : int = 0
-
The current index used for separate unique JOINs.
Return values
array<string|int, mixed> —List of SQL statements to be used as WHERE arguments
randomChar()
Return a random character picked from the given string
protected
static randomChar(string $chars) : string
Returns the empty string if the given one has length 0 (zero).
Parameters
- $chars : string
Return values
stringsendUserAccountInvitationMail()
Send a invitation mail to the created user.
protected
sendUserAccountInvitationMail(string $generatedPassword) : mixed
It used the old mail function
Parameters
- $generatedPassword : string
storeProfile()
protected
storeProfile([mixed &$profileUpdated = null ]) : mixed
Parameters
- $profileUpdated : mixed = null
-
If $profileUpdated is provided, then in case any profile changes are being flushed to the database, $profileUpdated will be set to TRUE, otherwise it'll be left untouched.
updateLoadedUserData()
Update a specific profile attribute of the user
protected
updateLoadedUserData(string $attribute, string|int|bool $value) : mixed
Parameters
- $attribute : string
-
ID of profile attribute to update
- $value : string|int|bool
-
Value to set the profile attribute to
updatePasswordHash()
Verify that the password is properly hashed
protected
updatePasswordHash(string $password[, string $passwordHash = '' ]) : mixed
If the hashed password is outdated it will be updated in the database.
Parameters
- $password : string
-
Current raw password
- $passwordHash : string = ''
-
The matching hash of the password. If not supplied, it will be fetched from the database.
Tags
updateUser()
protected
updateUser([mixed &$userChanged = null ]) : mixed
Parameters
- $userChanged : mixed = null
-
If $userChanged is provided, then in case any account changes are being flushed to the database, $userChanged will be set to TRUE, otherwise it'll be left untouched.
clean()
Clean user metadata
private
clean() : mixed
Reset all user metadata for a new user. The metadata includes the ID of the user, the username, e-mail address, password, language ID, active and administration status, registration date, restore key and restore key timeout and the ID's of the associated groups.
getFilteredUserIdList()
private
getFilteredUserIdList([mixed $arrFilter = null ][, mixed $search = null ]) : mixed
Parameters
- $arrFilter : mixed = null
- $search : mixed = null
getShopUserEmail()
Returns the e-mail address if the User accounts has been created by the Shop.
private
getShopUserEmail() : string
Such accounts have e-mail addresses that look like "shop_customer_$orderId_$productId_$instance-$email" Note that this is a temporary workaround and will be changed in a future release.
Tags
Return values
string —The e-mail address if the account was autocreated by the Shop, the empty string otherwise.
initAttributes()
private
initAttributes() : mixed
isLastAdmin()
Returns true if the current User has the only active admin account present in the system.
private
isLastAdmin() : bool
Returns false if either
- the current User is not an admin, or
- there are at least two active admins present Note that true is returned if the database query fails, so the User will not be allowed to be deleted. You might have a whole different kind of problem in that case anyway.
Tags
Return values
boolload()
Load user data
private
load(int $id[, bool $forceReload = false ]) : bool
Load all user data (username, email, lang_id, is_active, etc.) of the user specified by ID $id into the current instance.
Parameters
- $id : int
-
The ID of the user to load
- $forceReload : bool = false
-
Set to TRUE to refetch the user from the database. Otherwise, the user will be loaded from cache, in case it has been loaded before. Defaults to FALSE.
Tags
Return values
bool —TRUE on success, otherwise FALSE
loadGroups()
Load group ID's of user
private
loadGroups([bool $onlyActiveGroups = false ]) : mixed
Returns an array with the ID's of all groups to which the user is associated to.
Parameters
- $onlyActiveGroups : bool = false
Tags
Return values
mixed —array on success, FALSE on failure
loadPermissionIds()
private
loadPermissionIds(mixed $type) : mixed
Parameters
- $type : mixed
loadSubscribedNewsletterListIDs()
private
loadSubscribedNewsletterListIDs() : mixed
parseAccountFilterConditions()
Parse account filter conditions
private
parseAccountFilterConditions(array<string|int, mixed> $arrFilter) : array<string|int, mixed>
Generate conditions of the account attributes for the SQL WHERE statement. The filter conditions are defined through the two dimensional array $arrFilter. Each key-value pair represents an attribute and its associated condition to which it must fit to. The condition could either be a integer or string depending on the attributes type, or it could be a collection of integers or strings represented in an array.
Examples of the filer array:
array( 'firstname' => '%nicole%', ) // will return all users who's firstname include 'nicole'
array( 'firstname' => array( 'd%', 'e%', 'f%', 'g%' ) ) // will return all users which have a firstname of which its first letter is and between 'd' to 'g' (case less)
array( 'firstname' => array( array( '>' => 'd', '<' => 'g' ), 'LIKE' => 'g%' ) ) // same as the preview example but in an other way
array( 'is_active' => 1, 'last_auth' => array( '>' => time()-3600 ) ) // will return all users that are active and have been logged in at least in the last one hour
Parameters
- $arrFilter : array<string|int, mixed>
Return values
array<string|int, mixed>parseAccountSearchConditions()
Creates the SQL query snippet to match username (and e-mail in the backend) fields against the search term(s)
private
parseAccountSearchConditions(mixed $search) : array<string|int, mixed>
Matches single (scalar) or multiple (array) search terms against a number of fields. Generally, the term(s) are enclosed in percent signs ("%term%"), so any fields that contain them will match. However, if the search parameter is a string and does contain a percent sign already, none will be added to the query. This allows searches using custom patterns, like "fields beginning with "a" ("a%"). (You might even want to extend this to work with arrays, too. Currently, only the shop module uses this feature.) -- RK 20100910
Parameters
- $search : mixed
-
The term or array of terms
Return values
array<string|int, mixed> —The array of SQL snippets
removeOutdatedAccounts()
private
static removeOutdatedAccounts() : mixed
setSortedUserIdList()
private
setSortedUserIdList(mixed $arrSort[, mixed $sqlCondition = array() ][, mixed $limit = null ][, mixed $offset = null ][, mixed $groupless = false ][, mixed $crmUser = false ]) : mixed
Parameters
- $arrSort : mixed
- $sqlCondition : mixed = array()
- $limit : mixed = null
- $offset : mixed = null
- $groupless : mixed = false
- $crmUser : mixed = false
storeGroupAssociations()
Store group associations
private
storeGroupAssociations([mixed &$associationChange = null ]) : bool
Stores the group associations of the loaded user. Returns TRUE on success, FALSE on failure.
Parameters
- $associationChange : mixed = null
-
If $associationChange is provided, then in case any group association changes are being flushed to the database, $associationChange will be set to TRUE, otherwise it'll be left untouched.
Tags
Return values
boolstoreNewsletterSubscriptions()
Store the user's newsletter-list-subscriptions to the database
private
storeNewsletterSubscriptions([mixed &$subscriptionChange = null ]) : bool
Parameters
- $subscriptionChange : mixed = null
-
If $subscriptionChange is provided, then in case any newsletter list subscription changes are being flushed to the database, $subscriptionChange will be set to TRUE, otherwise it'll be left untouched.
Return values
boolupdateLastActivityTime()
private
updateLastActivityTime() : mixed
updateLastAuthTime()
private
updateLastAuthTime() : mixed
validateLanguageId()
Validate language id
private
validateLanguageId(string $scope) : mixed
Checks if the language ids frontend_lang_id and backend_lang_id are valid language IDs. In the case that the specified language isn't valid, the ID 0 is taken instead. $scope could either be 'frontend' or 'backend'
Parameters
- $scope : string