PHP Класс UserModel, vanilla

Наследование: extends Model
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$SessionColumns
$UserMegaThreshold The number of users when extreme database optimizations kick in.
$UserThreshold The number of users when database optimizations kick in.

Открытые методы

Метод Описание
__construct ( ) Class constructor. Defines the related database table name.
addInsertFields ( &$Fields ) Parent override.
addPasswordStrength ( Gdn_Controller $Controller ) Set password strength meter on a form.
approve ( integer $UserID, string $Email ) : boolean Approve a membership applicant.
attributes ( array | object $user ) : array Reliably get the attributes from any user array or object.
ban ( integer $UserID, array $Options ) Manually ban a user.
checkPermission ( mixed $User, mixed $Permission, array $Options = [] ) : boolean Checks the specified user's for the given permission. Returns a boolean value indicating if the action is permitted.
clearCache ( integer | null $UserID, $CacheTypesToClear = null ) : boolean Delete cached data for user.
clearNavigationPreferences ( string $userID = '' ) Clears navigation preferences for a user.
clearPermissions ( ) Clear the permission cache.
clearSectionNavigationPreference ( string $url = '', string $userID = '', boolean $resetSectionPreference = true ) Checks if a url is saved as a navigation preference and if so, deletes it.
compilePermissions ( array $rawPermissions ) : array Take raw permission definitions and create.
confirmEmail ( array | object $User, string $EmailKey ) : boolean Users respond to confirmation emails by clicking a link that takes them here.
connect ( string $UniqueID, string $ProviderKey, array $UserData, array $Options = [] ) : integer Connect a user with a foreign authentication system.
countEstimate ( ) : integer Approximate the number of users by checking the database table status.
counts ( string $Column, integer | null $UserID = null ) User counts.
decline ( integer $UserID ) : boolean Decline a user's application to join the forum.
definePermissions ( integer $UserID, boolean $Serialize = false ) : array Load and compile user permissions
delete ( $where = [], $options = [] ) Delete a user.
deleteContent ( integer $UserID, array $Options = [], array $Content = [] ) : boolean | integer Delete a user's content across many contexts.
deleteID ( integer $userID, array $options = [] ) Delete a single user.
filterForm ( array $data, boolean $register = false ) : array Filter dangerous fields out of user-submitted data.
fixGender ( string $Value ) : string Force gender to be a verified value.
get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $Offset = false ) : object Default Gdn_Model::get() behavior.
getActiveUsers ( integer $Limit = 5 ) : Gdn_DataSet Get the most recently active users.
getApplicantCount ( ) : integer Get the current number of applicants waiting to be approved.
getApplicants ( ) : Gdn_DataSet Returns all users in the applicant role.
getAttribute ( integer $UserID, string $Attribute, mixed $DefaultValue = false ) : mixed Get an Attribute from a single user.
getAuthentication ( string $UniqueID, string $Provider ) : array | false Get the a user authentication row.
getByEmail ( string $Email ) : array | boolean | stdClass Get user by email address.
getByRole ( integer | string $Role ) : Gdn_DataSet Get users by role.
getByUsername ( string $Username ) : boolean | object Get a user by their username.
getCountLike ( array | boolean $Like = false ) : integer
getCountWhere ( array | false $Where = false ) : integer
getDefaultAvatarUrl ( array $user = [], string $size = 'thumbnail' ) : string Returns the url to the default avatar for a user.
getDelete ( string $Table, array $Where, array &$Data ) Get rows from a table then delete them.
getID ( integer $ID, string | false $DatasetType = false, array $Options = [] ) : array | object | false Get a user by ID.
getIDs ( array $IDs, boolean $SkipCacheQuery = false ) : array
getIPs ( integer $userID ) : array Retrieve IP addresses associated with a user.
getInvitationCount ( integer $UserID ) : integer Get number of available invites a user has.
getLike ( boolean $Like = false, string $OrderFields = '', string $OrderDirection = 'asc', boolean $Limit = false, boolean $Offset = false ) : Gdn_DataSet
getMeta ( integer $UserID, string $Key, string $Prefix = '', string $Default = '' ) : array Retries UserMeta information for a UserID / Key pair.
getPermissions ( integer $userID ) : Vanilla\Permissions Get a user's permissions.
getPermissionsIncrement ( ) : boolean | integer | mixed
getRoles ( integer $userID ) : Gdn_DataSet Get the roles for a user.
getSession ( integer $UserID, boolean $Refresh = false ) : array | object | false
getSummary ( string $OrderFields = '', string $OrderDirection = 'asc', boolean $Limit = false, boolean $Offset = false ) : array | null Retrieve a summary of "safe" user information for external API calls.
getSystemUserID ( ) : integer Retrieves a "system user" id that can be used to perform non-real-person tasks.
getUserFromCache ( string | integer $UserToken, string $TokenType ) : array | false Get a user from the cache by name or ID
givePoints ( integer $UserID, integer $Points, string $Source = 'Other', integer | false $Timestamp = false ) Add points to a user's total.
increaseInviteCount ( integer $UserID, integer $IncreaseBy = 1 ) Increases the user's CountInvitations value by the specified amount.
insertForApproval ( array $FormPostValues, array $Options = [] ) : integer To be used for approval registration.
insertForBasic ( array $FormPostValues, boolean $CheckCaptcha = true, array $Options = [] ) : boolean | integer | string To be used for basic registration, and captcha registration.
insertForInvite ( array $FormPostValues, array $Options = [] ) : integer To be used for invitation registration.
joinUsers ( array | Gdn_DataSet &$Data, array $Columns, array $Options = [] ) Add user data to a result set.
merge ( integer $OldUserID, integer $NewUserID ) Merge the old user into the new user.
newUserRoleIDs ( ) : array
noEmail ( ) : boolean Whether or not users have email addresses.
passwordRequest ( string $Email ) : boolean Send forgot password email.
passwordReset ( integer $UserID, string $Password ) : array | false Do a password reset.
pastUserMegaThreshold ( ) : boolean Whether we're wandered into extreme database optimization territory with our user count.
pastUserThreshold ( ) : boolean Whether or not we are past the user threshold.
profileCount ( integer | string | object $User, string $Column ) : integer | false Get a user's counter.
rateLimit ( array $User, boolean $PasswordOK ) Check and apply login rate limiting
reduceInviteCount ( integer $UserID, integer $ReduceBy = 1 ) Reduces the user's CountInvitations value by the specified amount.
register ( array $FormPostValues, array $Options = [] ) : boolean | integer | string Register a new user.
removePicture ( integer $UserID ) Remove the photo from a user.
requireConfirmEmail ( ) : boolean Whether or not the application requires email confirmation.
save ( array $FormPostValues, array $Settings = [] ) Generic save procedure.
saveAbout ( integer $UserID, string $About ) Saves the user's About field.
saveAdminUser ( array $FormPostValues ) Create an admin user account.
saveAttribute ( integer $UserID, mixed $Attribute, mixed $Value = '' ) Saves a user attribute to the database.
saveAuthentication ( array $Data ) : Gdn_DataSet | string
saveIP ( integer $userID, string $IP, string $dateUpdated = false ) : boolean Record an IP address for a user.
savePreference ( integer $UserID, mixed $Preference, mixed $Value = '' ) Saves a user preference to the database.
saveRoles ( integer $UserID, array $RoleIDs, boolean $RecordEvent )
saveToSerializedColumn ( string $Column, integer $UserID, mixed $Name, mixed $Value = '' ) Saves a name/value to the user's specified $Column.
search ( array | string $Filter, string $OrderFields = '', string $OrderDirection = 'asc', boolean $Limit = false, boolean $Offset = false ) : Gdn_DataSet Search users.
searchCount ( array | string $Filter = '' ) : integer Count search results.
sendEmailConfirmationEmail ( integer | string | null $User = null, boolean $Force = false ) Send the confirmation email.
sendPasswordEmail ( integer $UserID, string $Password ) Send password email.
sendWelcomeEmail ( integer $UserID, string $Password, string $RegisterType = 'Add', array | null $AdditionalData = null ) Send welcome email to user.
setCalculatedFields ( &$User ) Set fields that need additional manipulation after retrieval.
setField ( integer $RowID, array | string $Property, boolean $Value = false ) : boolean Set a single user property.
setMeta ( integer $UserID, array $Meta, string $Prefix = '' )
setTransientKey ( integer $UserID, string $ExplicitKey = '' ) : string Set the TransientKey attribute on a user.
signinLabelCode ( ) : string
sso ( string $String, boolean $ThrowError = false ) : integer | void Initiate an SSO connection.
syncUser ( array | integer $CurrentUser, array $NewUser, boolean $Force = false ) Sync user data.
synchUser ( array | integer $CurrentUser, array $NewUser, boolean $Force = false ) Sync user data.
synchronize ( string $UserKey, array $Data ) : integer Synchronizes the user based on a given UserKey.
tagSearch ( string $Search, integer $Limit = 10 ) A simple search for tag queries.
unBan ( integer $UserID, array $Options = [] ) Unban a user.
updateUserCache ( integer $UserID, string | array $Field, mixed | null $Value = null )
updateVisit ( integer $UserID, string | integer | float $ClientHour = false ) Updates visit level information such as date last active and the user's ip address.
userCache ( array $User, $UserID = null ) : boolean Cache a user.
userCacheRoles ( integer $userID, array $roleIDs ) : boolean Cache a user's roles.
userQuery ( boolean $SafeData = false ) Query the user table.
validate ( array $FormPostValues, boolean $Insert = false ) : boolean | array Validate submitted user data.
validateCredentials ( string $Email = '', $ID, string $Password ) : object | false Validate User Credential.
validateSpamRegistration ( array $User ) : boolean | string
validateUniqueFields ( string $Username, string $Email, string $UserID = '', boolean $Return = false ) : array | boolean Checks to see if $Username and $Email are already in use by another member.

Защищенные методы

Метод Описание
getEmailWelcome ( string $registerType, object | array $user, array $data, string $password = '' ) : string Resolves the welcome email format. Maintains backwards compatibility with the 'EmailWelcome*' translations for overriding.
lookupRoleIDs ( array $Roles ) : array
mergeFinish ( integer $MergeID ) Finish merging user accounts.

Приватные методы

Метод Описание
addEmailHeaderFooter ( string $Message, array $Data ) : string Deprecated.
addIpFilters ( string $ip, array $fields = [] ) Appends filters to the current SQL object. Filters users with a given IP Address in the UserIP table. Extends filtering to IPs in the GDN_User table for any fields passed in the $fields param.
givePointsInternal ( integer $UserID, integer $Points, string $SlotType, string $Source = 'Total', integer $CategoryID, integer | false $Timestamp = false ) Add points to a user's total in a specific time slot.
insertInternal ( array $Fields, array $Options = [] ) : integer | false A convenience method to be called when inserting users.
mergeCopy ( integer $MergeID, string $Table, string $Column, integer $OldUserID, integer $NewUserID, string $PK = '' ) Backup user before merging.
mergeStart ( integer $OldUserID, integer $NewUserID ) : integer | null Start merging user accounts.

Описание методов

__construct() публичный Метод

Class constructor. Defines the related database table name.
public __construct ( )

addInsertFields() публичный Метод

Parent override.
public addInsertFields ( &$Fields )

addPasswordStrength() публичный Метод

Set password strength meter on a form.
public addPasswordStrength ( Gdn_Controller $Controller )
$Controller Gdn_Controller The controller to add the password strength information to.

approve() публичный Метод

Approve a membership applicant.
public approve ( integer $UserID, string $Email ) : boolean
$UserID integer
$Email string
Результат boolean

attributes() публичный статический Метод

Reliably get the attributes from any user array or object.
public static attributes ( array | object $user ) : array
$user array | object The user to get the attributes for.
Результат array Returns an attribute array.

ban() публичный Метод

Manually ban a user.
public ban ( integer $UserID, array $Options )
$UserID integer The ID of the user to ban.
$Options array Additional options for the ban.

checkPermission() публичный Метод

Checks the specified user's for the given permission. Returns a boolean value indicating if the action is permitted.
public checkPermission ( mixed $User, mixed $Permission, array $Options = [] ) : boolean
$User mixed The user to check.
$Permission mixed The permission (or array of permissions) to check.
$Options array Not used.
Результат boolean

clearCache() публичный Метод

Delete cached data for user.
public clearCache ( integer | null $UserID, $CacheTypesToClear = null ) : boolean
$UserID integer | null The user to clear the cache for.
Результат boolean Returns **true** if the cache was cleared or **false** otherwise.

clearNavigationPreferences() публичный Метод

Clears navigation preferences for a user.
public clearNavigationPreferences ( string $userID = '' )
$userID string Optional - defaults to sessioned user

clearPermissions() публичный Метод

Clear the permission cache.
public clearPermissions ( )

clearSectionNavigationPreference() публичный Метод

Also optionally resets the section dashboard landing page, which may be desirable if a user no longer has permission to access pages in that section.
public clearSectionNavigationPreference ( string $url = '', string $userID = '', boolean $resetSectionPreference = true )
$url string The url to search the user navigation preferences for, defaults to the request
$userID string The ID of the user to clear the preferences for, defaults to the sessioned user
$resetSectionPreference boolean Whether to reset the dashboard section landing page

compilePermissions() публичный статический Метод

Take raw permission definitions and create.
public static compilePermissions ( array $rawPermissions ) : array
$rawPermissions array Database rows from the permissions table.
Результат array Compiled permissions

confirmEmail() публичный Метод

Users respond to confirmation emails by clicking a link that takes them here.
public confirmEmail ( array | object $User, string $EmailKey ) : boolean
$User array | object The user confirming their email.
$EmailKey string The token that was emailed to the user.
Результат boolean Returns **true** if the email was confirmed.

connect() публичный Метод

Connect a user with a foreign authentication system.
public connect ( string $UniqueID, string $ProviderKey, array $UserData, array $Options = [] ) : integer
$UniqueID string The user's unique key in the other authentication system.
$ProviderKey string The key of the system providing the authentication.
$UserData array Data to go in the user table.
$Options array Additional connect options.
Результат integer The new/existing user ID.

countEstimate() публичный Метод

Approximate the number of users by checking the database table status.
public countEstimate ( ) : integer
Результат integer

counts() публичный Метод

User counts.
public counts ( string $Column, integer | null $UserID = null )
$Column string The name of the count column. (ex. CountDiscussions, CountComments).
$UserID integer | null The user ID to get the counts for or **null** for the current user.

decline() публичный Метод

Decline a user's application to join the forum.
public decline ( integer $UserID ) : boolean
$UserID integer
Результат boolean

definePermissions() публичный Метод

Load and compile user permissions
Устаревший: Use UserModel::getPermissions instead.
public definePermissions ( integer $UserID, boolean $Serialize = false ) : array
$UserID integer
$Serialize boolean
Результат array

delete() публичный Метод

public delete ( $where = [], $options = [] )

deleteContent() публичный Метод

Delete a user's content across many contexts.
public deleteContent ( integer $UserID, array $Options = [], array $Content = [] ) : boolean | integer
$UserID integer
$Options array
$Content array
Результат boolean | integer

deleteID() публичный Метод

Delete a single user.
public deleteID ( integer $userID, array $options = [] )
$userID integer The user to delete.
$options array See {@link UserModel::deleteContent()}, and {@link UserModel::getDelete()}.

filterForm() публичный Метод

Filter dangerous fields out of user-submitted data.
public filterForm ( array $data, boolean $register = false ) : array
$data array The data to filter.
$register boolean Whether or not this is a registration.
Результат array Returns a filtered version of {@link $data}.

fixGender() публичный статический Метод

Force gender to be a verified value.
public static fixGender ( string $Value ) : string
$Value string The gender string.
Результат string

get() публичный Метод

Prior to 2.0.18 it incorrectly behaved like GetID. This method can be deleted entirely once it's been deprecated long enough.
public get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $Offset = false ) : object
Результат object DataSet

getActiveUsers() публичный Метод

Get the most recently active users.
public getActiveUsers ( integer $Limit = 5 ) : Gdn_DataSet
$Limit integer The number of users to return.
Результат Gdn_DataSet Returns a list of users.

getApplicantCount() публичный Метод

Get the current number of applicants waiting to be approved.
public getApplicantCount ( ) : integer
Результат integer Returns the number of applicants or 0 if the registration method isn't set to approval.

getApplicants() публичный Метод

Returns all users in the applicant role.
public getApplicants ( ) : Gdn_DataSet
Результат Gdn_DataSet Returns a data set of the users who are applicants.

getAttribute() публичный Метод

Get an Attribute from a single user.
public getAttribute ( integer $UserID, string $Attribute, mixed $DefaultValue = false ) : mixed
$UserID integer
$Attribute string
$DefaultValue mixed
Результат mixed

getAuthentication() публичный Метод

Get the a user authentication row.
public getAuthentication ( string $UniqueID, string $Provider ) : array | false
$UniqueID string The unique ID of the user in the foreign authentication scheme.
$Provider string The key of the provider.
Результат array | false

getByEmail() публичный Метод

Get user by email address.
public getByEmail ( string $Email ) : array | boolean | stdClass
$Email string The email address of the user.
Результат array | boolean | stdClass Returns the user or **false** if they don't exist.

getByRole() публичный Метод

Get users by role.
public getByRole ( integer | string $Role ) : Gdn_DataSet
$Role integer | string The ID or name of the role.
Результат Gdn_DataSet Returns the users with the given role.

getByUsername() публичный Метод

Get a user by their username.
public getByUsername ( string $Username ) : boolean | object
$Username string The username of the user.
Результат boolean | object Returns the user or **false** if they don't exist.

getCountLike() публичный Метод

public getCountLike ( array | boolean $Like = false ) : integer
$Like array | boolean
Результат integer

getCountWhere() публичный Метод

public getCountWhere ( array | false $Where = false ) : integer
$Where array | false
Результат integer

getDefaultAvatarUrl() публичный статический Метод

Returns the url to the default avatar for a user.
public static getDefaultAvatarUrl ( array $user = [], string $size = 'thumbnail' ) : string
$user array The user to get the default avatar for.
$size string The size of avatar to return (only respected for dashboard-uploaded default avatars).
Результат string The url to the default avatar image.

getDelete() публичный Метод

Get rows from a table then delete them.
С версии: 2.1
public getDelete ( string $Table, array $Where, array &$Data )
$Table string The name of the table.
$Where array The where condition for the delete.
$Data array The data to put the result.

getEmailWelcome() защищенный Метод

Resolves the welcome email format. Maintains backwards compatibility with the 'EmailWelcome*' translations for overriding.
protected getEmailWelcome ( string $registerType, object | array $user, array $data, string $password = '' ) : string
$registerType string The registration type. One of 'Connect', 'Register' or 'Add'.
$user object | array The user to send the email to.
$data array The email data.
$password string The user's password.
Результат string The welcome email for the registration type.

getID() публичный Метод

Get a user by ID.
public getID ( integer $ID, string | false $DatasetType = false, array $Options = [] ) : array | object | false
$ID integer The ID of the user.
$DatasetType string | false Whether to return an array or object.
$Options array Additional options to affect fetching. Currently unused.
Результат array | object | false Returns the user or **false** if the user wasn't found.

getIDs() публичный Метод

public getIDs ( array $IDs, boolean $SkipCacheQuery = false ) : array
$IDs array
$SkipCacheQuery boolean
Результат array

getIPs() публичный Метод

Retrieve IP addresses associated with a user.
public getIPs ( integer $userID ) : array
$userID integer Unique ID for a user.
Результат array IP addresses for the user.

getInvitationCount() публичный Метод

Get number of available invites a user has.
public getInvitationCount ( integer $UserID ) : integer
$UserID integer
Результат integer

getLike() публичный Метод

public getLike ( boolean $Like = false, string $OrderFields = '', string $OrderDirection = 'asc', boolean $Limit = false, boolean $Offset = false ) : Gdn_DataSet
$Like boolean
$OrderFields string
$OrderDirection string
$Limit boolean
$Offset boolean
Результат Gdn_DataSet

getMeta() публичный статический Метод

This method takes a $UserID or array of $UserIDs, and a $Key. It converts the $Key to fully qualified format and then queries for the associated value(s). $Key can contain SQL wildcards, in which case multiple results can be returned. If $UserID is an array, the return value will be a multi dimensional array with the first axis containing UserIDs and the second containing fully qualified UserMetaKeys, associated with their values. If $UserID is a scalar, the return value will be a single dimensional array of $UserMetaKey => $Value pairs.
public static getMeta ( integer $UserID, string $Key, string $Prefix = '', string $Default = '' ) : array
$UserID integer UserID or array of UserIDs.
$Key string Relative user meta key.
$Prefix string
$Default string
Результат array results or $Default

getPermissions() публичный Метод

Get a user's permissions.
public getPermissions ( integer $userID ) : Vanilla\Permissions
$userID integer Unique ID of the user.
Результат Vanilla\Permissions

getPermissionsIncrement() публичный Метод

public getPermissionsIncrement ( ) : boolean | integer | mixed
Результат boolean | integer | mixed

getRoles() публичный Метод

Get the roles for a user.
public getRoles ( integer $userID ) : Gdn_DataSet
$userID integer The user to get the roles for.
Результат Gdn_DataSet Returns the roles as a dataset (with array values).

getSession() публичный Метод

public getSession ( integer $UserID, boolean $Refresh = false ) : array | object | false
$UserID integer
$Refresh boolean
Результат array | object | false

getSummary() публичный Метод

Retrieve a summary of "safe" user information for external API calls.
public getSummary ( string $OrderFields = '', string $OrderDirection = 'asc', boolean $Limit = false, boolean $Offset = false ) : array | null
$OrderFields string
$OrderDirection string
$Limit boolean
$Offset boolean
Результат array | null

getSystemUserID() публичный Метод

Retrieves a "system user" id that can be used to perform non-real-person tasks.
public getSystemUserID ( ) : integer
Результат integer Returns a user ID.

getUserFromCache() публичный Метод

Get a user from the cache by name or ID
public getUserFromCache ( string | integer $UserToken, string $TokenType ) : array | false
$UserToken string | integer either a userid or a username
$TokenType string either 'userid' or 'name'
Результат array | false Returns a user array or **false** if the user isn't in the cache.

givePoints() публичный статический Метод

Add points to a user's total.
С версии: 2.1.0
public static givePoints ( integer $UserID, integer $Points, string $Source = 'Other', integer | false $Timestamp = false )
$UserID integer
$Points integer
$Source string
$Timestamp integer | false

increaseInviteCount() публичный Метод

Increases the user's CountInvitations value by the specified amount.
public increaseInviteCount ( integer $UserID, integer $IncreaseBy = 1 )
$UserID integer The unique id of the user being affected.
$IncreaseBy integer The number to increase CountInvitations by.

insertForApproval() публичный Метод

To be used for approval registration.
public insertForApproval ( array $FormPostValues, array $Options = [] ) : integer
$FormPostValues array
$Options array
Результат integer UserID.

insertForBasic() публичный Метод

To be used for basic registration, and captcha registration.
public insertForBasic ( array $FormPostValues, boolean $CheckCaptcha = true, array $Options = [] ) : boolean | integer | string
$FormPostValues array
$CheckCaptcha boolean
$Options array
Результат boolean | integer | string

insertForInvite() публичный Метод

To be used for invitation registration.
public insertForInvite ( array $FormPostValues, array $Options = [] ) : integer
$FormPostValues array
$Options array
Результат integer UserID.

joinUsers() публичный Метод

Add user data to a result set.
public joinUsers ( array | Gdn_DataSet &$Data, array $Columns, array $Options = [] )
$Data array | Gdn_DataSet Results we need to associate user data with.
$Columns array Database columns containing UserIDs to get data for.
$Options array Optionally pass list of user data to collect with key 'Join'.

lookupRoleIDs() защищенный Метод

protected lookupRoleIDs ( array $Roles ) : array
$Roles array
Результат array

merge() публичный Метод

Merge the old user into the new user.
public merge ( integer $OldUserID, integer $NewUserID )
$OldUserID integer The ID of the old user.
$NewUserID integer The ID of the new user.

mergeFinish() защищенный Метод

Finish merging user accounts.
protected mergeFinish ( integer $MergeID )
$MergeID integer The merge table ID.

newUserRoleIDs() публичный Метод

public newUserRoleIDs ( ) : array
Результат array

noEmail() публичный статический Метод

Whether or not users have email addresses.
public static noEmail ( ) : boolean
Результат boolean

passwordRequest() публичный Метод

Send forgot password email.
public passwordRequest ( string $Email ) : boolean
$Email string
Результат boolean

passwordReset() публичный Метод

Do a password reset.
public passwordReset ( integer $UserID, string $Password ) : array | false
$UserID integer
$Password string
Результат array | false Returns the user or **false** if the user doesn't exist.

pastUserMegaThreshold() публичный Метод

Whether we're wandered into extreme database optimization territory with our user count.
public pastUserMegaThreshold ( ) : boolean
Результат boolean

pastUserThreshold() публичный Метод

This is a useful indication that some database operations on the User table will be painfully long.
public pastUserThreshold ( ) : boolean
Результат boolean

profileCount() публичный Метод

Get a user's counter.
public profileCount ( integer | string | object $User, string $Column ) : integer | false
$User integer | string | object
$Column string
Результат integer | false

rateLimit() публичный статический Метод

Check and apply login rate limiting
public static rateLimit ( array $User, boolean $PasswordOK )
$User array
$PasswordOK boolean

reduceInviteCount() публичный Метод

Reduces the user's CountInvitations value by the specified amount.
public reduceInviteCount ( integer $UserID, integer $ReduceBy = 1 )
$UserID integer The unique id of the user being affected.
$ReduceBy integer The number to reduce CountInvitations by.

register() публичный Метод

Register a new user.
public register ( array $FormPostValues, array $Options = [] ) : boolean | integer | string
$FormPostValues array
$Options array
Результат boolean | integer | string

removePicture() публичный Метод

Remove the photo from a user.
public removePicture ( integer $UserID )
$UserID integer

requireConfirmEmail() публичный статический Метод

Whether or not the application requires email confirmation.
public static requireConfirmEmail ( ) : boolean
Результат boolean

save() публичный Метод

Generic save procedure.
public save ( array $FormPostValues, array $Settings = [] )
$FormPostValues array The user to save.
$Settings array Controls certain save functionality. - SaveRoles - Save 'RoleID' field as user's roles. Default false. - HashPassword - Hash the provided password on update. Default true. - FixUnique - Try to resolve conflicts with unique constraints on Name and Email. Default false. - ValidateEmail - Make sure the provided email addresses is formatted properly. Default true. - NoConfirmEmail - Disable email confirmation. Default false.

saveAbout() публичный Метод

Saves the user's About field.
public saveAbout ( integer $UserID, string $About )
$UserID integer The UserID to save.
$About string The about message being saved.

saveAdminUser() публичный Метод

Create an admin user account.
public saveAdminUser ( array $FormPostValues )
$FormPostValues array

saveAttribute() публичный Метод

This is a convenience method that uses $this->SaveToSerializedColumn().
public saveAttribute ( integer $UserID, mixed $Attribute, mixed $Value = '' )
$UserID integer The UserID to save.
$Attribute mixed The name of the attribute being saved, or an associative array of name => value pairs to be saved. If this is an associative array, the $Value argument will be ignored.
$Value mixed The value being saved.

saveAuthentication() публичный Метод

public saveAuthentication ( array $Data ) : Gdn_DataSet | string
$Data array
Результат Gdn_DataSet | string

saveIP() публичный Метод

Record an IP address for a user.
public saveIP ( integer $userID, string $IP, string $dateUpdated = false ) : boolean
$userID integer Unique ID of the user.
$IP string Human-readable IP address.
$dateUpdated string Force an update timesetamp.
Результат boolean Was the operation successful?

savePreference() публичный Метод

This is a convenience method that uses $this->SaveToSerializedColumn().
public savePreference ( integer $UserID, mixed $Preference, mixed $Value = '' )
$UserID integer The UserID to save.
$Preference mixed The name of the preference being saved, or an associative array of name => value pairs to be saved. If this is an associative array, the $Value argument will be ignored.
$Value mixed The value being saved.

saveRoles() публичный Метод

public saveRoles ( integer $UserID, array $RoleIDs, boolean $RecordEvent )
$UserID integer
$RoleIDs array
$RecordEvent boolean

saveToSerializedColumn() публичный Метод

This method throws exceptions when errors are encountered. Use try catch blocks to capture these exceptions.
public saveToSerializedColumn ( string $Column, integer $UserID, mixed $Name, mixed $Value = '' )
$Column string The name of the serialized column to save to. At the time of this writing there are three serialized columns on the user table: Permissions, Preferences, and Attributes.
$UserID integer The UserID to save.
$Name mixed The name of the value being saved, or an associative array of name => value pairs to be saved. If this is an associative array, the $Value argument will be ignored.
$Value mixed The value being saved.

searchCount() публичный Метод

Count search results.
public searchCount ( array | string $Filter = '' ) : integer
$Filter array | string
Результат integer

sendEmailConfirmationEmail() публичный Метод

Send the confirmation email.
public sendEmailConfirmationEmail ( integer | string | null $User = null, boolean $Force = false )
$User integer | string | null
$Force boolean

sendPasswordEmail() публичный Метод

Send password email.
public sendPasswordEmail ( integer $UserID, string $Password )
$UserID integer
$Password string

sendWelcomeEmail() публичный Метод

Send welcome email to user.
public sendWelcomeEmail ( integer $UserID, string $Password, string $RegisterType = 'Add', array | null $AdditionalData = null )
$UserID integer
$Password string
$RegisterType string
$AdditionalData array | null

setCalculatedFields() публичный Метод

Set fields that need additional manipulation after retrieval.
public setCalculatedFields ( &$User )

setField() публичный Метод

Set a single user property.
public setField ( integer $RowID, array | string $Property, boolean $Value = false ) : boolean
$RowID integer
$Property array | string
$Value boolean
Результат boolean

setMeta() публичный статический Метод

public static setMeta ( integer $UserID, array $Meta, string $Prefix = '' )
$UserID integer
$Meta array
$Prefix string

setTransientKey() публичный Метод

Set the TransientKey attribute on a user.
public setTransientKey ( integer $UserID, string $ExplicitKey = '' ) : string
$UserID integer
$ExplicitKey string
Результат string

signinLabelCode() публичный статический Метод

public static signinLabelCode ( ) : string
Результат string

sso() публичный Метод

Initiate an SSO connection.
public sso ( string $String, boolean $ThrowError = false ) : integer | void
$String string
$ThrowError boolean
Результат integer | void

syncUser() публичный Метод

Sync user data.
С версии: 2.1
public syncUser ( array | integer $CurrentUser, array $NewUser, boolean $Force = false )
$CurrentUser array | integer
$NewUser array Data to overwrite user with.
$Force boolean

synchUser() публичный Метод

Sync user data.
Устаревший: since 2.2.
С версии: 2.1
public synchUser ( array | integer $CurrentUser, array $NewUser, boolean $Force = false )
$CurrentUser array | integer
$NewUser array Data to overwrite user with.
$Force boolean

synchronize() публичный Метод

Synchronizes the user based on a given UserKey.
public synchronize ( string $UserKey, array $Data ) : integer
$UserKey string A string that uniquely identifies this user.
$Data array Information to put in the user table.
Результат integer The ID of the user.

tagSearch() публичный Метод

A simple search for tag queries.
С версии: 2.2
public tagSearch ( string $Search, integer $Limit = 10 )
$Search string
$Limit integer

unBan() публичный Метод

Unban a user.
С версии: 2.1
public unBan ( integer $UserID, array $Options = [] )
$UserID integer The user to unban.
$Options array Options for the unban.

updateUserCache() публичный Метод

public updateUserCache ( integer $UserID, string | array $Field, mixed | null $Value = null )
$UserID integer
$Field string | array
$Value mixed | null

updateVisit() публичный Метод

Updates visit level information such as date last active and the user's ip address.
public updateVisit ( integer $UserID, string | integer | float $ClientHour = false )
$UserID integer
$ClientHour string | integer | float

userCache() публичный Метод

Cache a user.
public userCache ( array $User, $UserID = null ) : boolean
$User array The user to cache.
Результат boolean Returns **true** if the user was cached or **false** otherwise.

userCacheRoles() публичный Метод

Cache a user's roles.
public userCacheRoles ( integer $userID, array $roleIDs ) : boolean
$userID integer The ID of a user to cache roles for.
$roleIDs array A collection of role IDs with the specified user.
Результат boolean Was the caching operation successful?

userQuery() публичный Метод

Query the user table.
public userQuery ( boolean $SafeData = false )
$SafeData boolean Makes sure that the query does not return any sensitive information about the user. (password, attributes, preferences, etc).

validate() публичный Метод

Validate submitted user data.
public validate ( array $FormPostValues, boolean $Insert = false ) : boolean | array
$FormPostValues array
$Insert boolean
Результат boolean | array

validateCredentials() публичный Метод

Fetches a user row by email (or name) and compare the password. If the password was not stored as a blowfish hash, the password will be saved again. Return the user's id, admin status and attributes.
public validateCredentials ( string $Email = '', $ID, string $Password ) : object | false
$Email string
$Password string
Результат object | false Returns the user matching the credentials or **false** if the user doesn't validate.

validateSpamRegistration() публичный Метод

С версии: 2.1
public validateSpamRegistration ( array $User ) : boolean | string
$User array
Результат boolean | string

validateUniqueFields() публичный Метод

Checks to see if $Username and $Email are already in use by another member.
public validateUniqueFields ( string $Username, string $Email, string $UserID = '', boolean $Return = false ) : array | boolean
$Username string
$Email string
$UserID string
$Return boolean
Результат array | boolean

Описание свойств

$SessionColumns публичное свойство

public $SessionColumns

$UserMegaThreshold публичное свойство

The number of users when extreme database optimizations kick in.
public $UserMegaThreshold

$UserThreshold публичное свойство

The number of users when database optimizations kick in.
public $UserThreshold