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
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
- getGenderLabel() : string
- Returns the localized label for a given gender option.
- getGenderMenu() : string
- Returns the HTML dropdown menu code for selecting the gender/title
- getGenderOptions() : array<string|int, mixed>
- Returns a list of gender options with their corresponding labels.
- 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
- getUsernameOrEmail() : mixed
- getUsers() : Customer
- Returns a Customer object according to the given criteria
- getValidityTimePeriod() : mixed
- group_id() : int
- Get or set the Customer group ID
- hasBackendAccess() : bool
- Tells whether this user has access to the backend
- hashPassword() : string
- Generate hash of password with default hash algorithm
- hasModeAccess() : bool
- Tells whether this user has access to back- or frontend
- 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() : bool
- This will check if there is an active session present for the current requester and if the requester has successfully been authenticated. If so, then the associated user object will be loaded into this user instance and {@see static::$loggedIn} will be set to `true`.
- 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
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
Methods
__clone()
public
__clone() : mixed
Attributes
- #[ReturnTypeWillChange]
__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
getGenderLabel()
Returns the localized label for a given gender option.
public
static getGenderLabel(string $gender[, bool $showUndefined = false ]) : string
If the provided $gender key exists in the list of gender options (as returned by Customer::getGenderOptions()), this method returns the corresponding localized label. Otherwise, it returns an empty string.
Parameters
- $gender : string
-
The gender option key (e.g., 'gender_male', 'gender_female', 'gender_undefined').
- $showUndefined : bool = false
-
Set to
true
to return the label ofgender_undefined
as instead of just an empty string.
Return values
string —The localized label for the given gender, or an empty string if not found.
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
getGenderOptions()
Returns a list of gender options with their corresponding labels.
public
static getGenderOptions([bool $withUndefined = false ]) : array<string|int, mixed>
By default, the returned array includes 'gender_male' and 'gender_female'.
If $withUndefined is true, 'gender_undefined' will be included at the
start of the array.
Each returned option key maps to its localized label derived from the
global language array $_ARRAYLANG
, using the prefix TXT_SHOP_
and
the uppercased gender option.
Parameters
- $withUndefined : bool = false
-
Whether to include 'gender_undefined' as an option.
Return values
array<string|int, mixed> —An associative array where keys are gender option keys and values are their localized labels.
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|array<string|int, mixed> $id[, bool $forceReload = false ]) : mixed
Parameters
- $id : int|array<string|int, mixed>
-
The ID of the user to fetch. Alternatively, $id may be an array of filter criteria defined by \User::getUsers($filter). If this matches multiple users, then the first user matching the filter criteria will be returned.
- $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
getUsernameOrEmail()
public
getUsernameOrEmail() : mixed
Tags
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
hasBackendAccess()
Tells whether this user has access to the backend
public
hasBackendAccess() : bool
Tags
Return values
bool —True if user has access to backend
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()
Tells whether this user has access to back- or frontend
public
hasModeAccess([bool $backend = false ]) : bool
Parameters
- $backend : bool = false
-
True for backend access check, defaults to false
Tags
Return values
bool —Whether this user has access to the given mode
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()
This will check if there is an active session present for the current requester and if the requester has successfully been authenticated. If so, then the associated user object will be loaded into this user instance and {@see static::$loggedIn} will be set to `true`.
public
login([bool $backend = false ]) : bool
Parameters
- $backend : bool = false
-
Set to
true
to constrain the login to backend access. Meaning that users without permission to access the backend will not succeed to login.
Tags
Return values
bool —true
if the current requester is successfully authenticated
and authorized to access the requested mode (set through $backend
).
Otherwise 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>
-
List of group IDs
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.