A user entity.
More...
|
static | current ($returnObjectIfNotExist=false) |
|
static | sendRecoveryLink ($data) |
| Send an account recovery link. More...
|
|
static | recover ($data) |
| Recover account details. More...
|
|
static | getClientConfig () |
|
static | generateSecret ($user) |
|
static | loginUser ($data) |
|
|
const | ETYPE = 'tilmeld_user' |
|
const | DEFAULT_CLIENT_ENABLED_METHODS |
|
const | DEFAULT_PRIVATE_DATA |
|
const | DEFAULT_WHITELIST_DATA = [] |
|
|
static | $clientEnabledStaticMethods |
|
static | $searchRestrictedData = User::DEFAULT_PRIVATE_DATA |
|
|
| $tags = [] |
|
| $clientEnabledMethods = User::DEFAULT_CLIENT_ENABLED_METHODS |
|
| $privateData = User::DEFAULT_PRIVATE_DATA |
|
| $whitelistData = User::DEFAULT_WHITELIST_DATA |
|
| $whitelistTags = [] |
|
A user entity.
Properties:
- int $this->guid The GUID of the user.
- string $this->username The user's username.
- string $this->nameFirst The user's first name.
- string $this->nameMiddle The user's middle name.
- string $this->nameLast The user's last name.
- string $this->name The user's full name.
- string $this->email The user's email address.
- string $this->originalEmail Used to save the current email to send verification if it changes.
- string $this->avatar The user's avatar URL. (Use getAvatar() to support Gravatar.)
- string $this->phone The user's telephone number.
- string $this->addressType The user's address type. "us" or "international".
- string $this->addressStreet The user's address line 1 for US addresses.
- string $this->addressStreet2 The user's address line 2 for US addresses.
- string $this->addressCity The user's city for US addresses.
- string $this->addressState The user's state abbreviation for US addresses.
- string $this->addressZip The user's ZIP code for US addresses.
- string $this->addressInternational The user's full address for international addresses.
- \Tilmeld\Entities\Group $this->group The user's primary group.
- array $this->groups The user's secondary groups.
- bool $this->inheritAbilities Whether the user should inherit the abilities of his groups.
- string $this->passwordTemp Temporary storage for passwords. This will be hashed before going into the database.
- Author
- Hunter Perrin hperr.nosp@m.in@g.nosp@m.mail..nosp@m.com
- Copyright
- SciActive.com
- See also
- http://tilmeld.org/
Definition at line 59 of file User.php.
◆ __construct()
Tilmeld\Entities\User::__construct |
( |
|
$id = 0 | ) |
|
Load a user.
- Parameters
-
int | string | $id | The ID or username of the user to load, 0 for a new user. |
Definition at line 142 of file User.php.
◆ __get()
& Tilmeld\Entities\User::__get |
( |
|
$name | ) |
|
Override the magic method, for email usernames.
- Parameters
-
string | $name | The name of the variable. |
- Returns
- mixed The value of the variable or nothing if it doesn't exist.
Definition at line 193 of file User.php.
◆ __isset()
Tilmeld\Entities\User::__isset |
( |
|
$name | ) |
|
Override the magic method, for email usernames.
- Parameters
-
string | $name | The name of the variable. |
- Returns
- bool
Definition at line 209 of file User.php.
◆ __set()
Tilmeld\Entities\User::__set |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Override the magic method, for email usernames.
- Parameters
-
string | $name | The name of the variable. |
string | $value | The value of the variable. |
- Returns
- mixed The value of the variable.
Definition at line 223 of file User.php.
◆ __unset()
Tilmeld\Entities\User::__unset |
( |
|
$name | ) |
|
Override the magic method, for email usernames.
- Parameters
-
string | $name | The name of the variable. |
Definition at line 239 of file User.php.
◆ addGroup()
Tilmeld\Entities\User::addGroup |
( |
|
$group | ) |
|
Add the user to a (secondary) group.
- Parameters
-
\Tilmeld\Entities\Group | $group | The group. |
- Returns
- mixed True if the user is already in the group. The resulting array of groups if the user was not.
Definition at line 808 of file User.php.
◆ changePassword()
Tilmeld\Entities\User::changePassword |
( |
|
$data | ) |
|
A frontend accessible method to change the user's password.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 900 of file User.php.
◆ checkEmail()
Tilmeld\Entities\User::checkEmail |
( |
| ) |
|
Check that an email is unique.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 1022 of file User.php.
◆ checkPassword()
Tilmeld\Entities\User::checkPassword |
( |
|
$password | ) |
|
Check the given password against the user's.
- Parameters
-
string | $password | The password in question. |
- Returns
- bool True if the passwords match, otherwise false.
Definition at line 822 of file User.php.
◆ checkPhone()
Tilmeld\Entities\User::checkPhone |
( |
| ) |
|
Check that a phone number is unique.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 1073 of file User.php.
◆ checkUsername()
Tilmeld\Entities\User::checkUsername |
( |
| ) |
|
Check that a username is valid.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 942 of file User.php.
◆ delGroup()
Tilmeld\Entities\User::delGroup |
( |
|
$group | ) |
|
Remove the user from a (secondary) group.
- Parameters
-
\Tilmeld\Entities\Group | $group | The group. |
- Returns
- mixed True if the user wasn't in the group. The resulting array of groups if the user was.
Definition at line 841 of file User.php.
◆ gatekeeper()
Tilmeld\Entities\User::gatekeeper |
( |
|
$ability = null | ) |
|
Check to see if a user has an ability.
This function will check both user and group abilities, if the user is marked to inherit the abilities of its group.
If $ability is null, it will check to see if the user is currently logged in.
If the user has the "system/admin" ability, this function will return true.
- Parameters
-
string | $ability | The ability. |
- Returns
- bool True or false.
Definition at line 663 of file User.php.
◆ getTimezone()
Tilmeld\Entities\User::getTimezone |
( |
|
$returnDateTimeZoneObject = false | ) |
|
Return the user's timezone.
First checks if the user has a timezone set, then the primary group, then the secondary groups, then the system default. The first timezone found is returned.
- Parameters
-
bool | $returnDateTimeZoneObject | Whether to return an object of the DateTimeZone class, instead of an identifier string. |
- Returns
- string|DateTimeZone The timezone identifier or the DateTimeZone object.
Definition at line 544 of file User.php.
◆ inGroup()
Tilmeld\Entities\User::inGroup |
( |
|
$group = null | ) |
|
Check whether the user is in a (primary or secondary) group.
- Parameters
-
mixed | $group | The group, or the group's GUID. |
- Returns
- bool True or false.
Definition at line 859 of file User.php.
◆ isDescendant()
Tilmeld\Entities\User::isDescendant |
( |
|
$group = null | ) |
|
Check whether the user is a descendant of a group.
- Parameters
-
mixed | $group | The group, or the group's GUID. |
- Returns
- bool True or false.
Definition at line 875 of file User.php.
◆ logout()
Tilmeld\Entities\User::logout |
( |
| ) |
|
Log a user out of the system.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 493 of file User.php.
◆ password()
Tilmeld\Entities\User::password |
( |
|
$password | ) |
|
Change the user's password.
- Parameters
-
string | $password | The new password. |
- Returns
- string The resulting SHA-256 sum which is stored in the entity.
Definition at line 921 of file User.php.
◆ recover()
static Tilmeld\Entities\User::recover |
( |
|
$data | ) |
|
|
static |
Recover account details.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 388 of file User.php.
◆ sendEmailVerification()
Tilmeld\Entities\User::sendEmailVerification |
( |
| ) |
|
Send the user email verification/change/cancellation links.
- Returns
- bool True on success, false on failure.
Definition at line 705 of file User.php.
◆ sendRecoveryLink()
static Tilmeld\Entities\User::sendRecoveryLink |
( |
|
$data | ) |
|
|
static |
Send an account recovery link.
- Returns
- array An associative array with a boolean 'result' entry and a 'message' entry.
Definition at line 263 of file User.php.
◆ updateDataProtection()
Tilmeld\Entities\User::updateDataProtection |
( |
|
$user = null | ) |
|
Update the data protection arrays for a user.
- Parameters
-
\Tilmeld\Entities\User | null | $user | User to update protection for. If null, will use the currently logged in user. |
Definition at line 576 of file User.php.
◆ $clientEnabledStaticMethods
Tilmeld\Entities\User::$clientEnabledStaticMethods |
|
static |
Initial value:= [
'current',
'loginUser',
'sendRecoveryLink',
'recover',
'getClientConfig',
]
Definition at line 97 of file User.php.
◆ DEFAULT_CLIENT_ENABLED_METHODS
const Tilmeld\Entities\User::DEFAULT_CLIENT_ENABLED_METHODS |
Initial value:= [
'checkUsername',
'checkEmail',
'checkPhone',
'getAvatar',
'register',
]
Definition at line 61 of file User.php.
◆ DEFAULT_PRIVATE_DATA
const Tilmeld\Entities\User::DEFAULT_PRIVATE_DATA |
Initial value:= [
'email',
'originalEmail',
'phone',
'addressType',
'addressStreet',
'addressStreet2',
'addressCity',
'addressState',
'addressZip',
'addressInternational',
'group',
'groups',
'abilities',
'inheritAbilities',
'timezone',
'recoverSecret',
'recoverSecretTime',
'password',
'passwordTemp',
'salt',
'secret',
'cancelEmailAddress',
'cancelEmailSecret',
'emailChangeDate',
]
Definition at line 68 of file User.php.
The documentation for this class was generated from the following file: