PHP Class UserModel, vanilla

Inheritance: extends Model
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Свойство Type Description
$SessionColumns
$UserMegaThreshold The number of users when extreme database optimizations kick in.
$UserThreshold The number of users when database optimizations kick in.

Méthodes publiques

Méthode Description
__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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

__construct() public méthode

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

addInsertFields() public méthode

Parent override.
public addInsertFields ( &$Fields )

addPasswordStrength() public méthode

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() public méthode

Approve a membership applicant.
public approve ( integer $UserID, string $Email ) : boolean
$UserID integer
$Email string
Résultat boolean

attributes() public static méthode

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.
Résultat array Returns an attribute array.

ban() public méthode

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() public méthode

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.
Résultat boolean

clearCache() public méthode

Delete cached data for user.
public clearCache ( integer | null $UserID, $CacheTypesToClear = null ) : boolean
$UserID integer | null The user to clear the cache for.
Résultat boolean Returns **true** if the cache was cleared or **false** otherwise.

clearNavigationPreferences() public méthode

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

clearPermissions() public méthode

Clear the permission cache.
public clearPermissions ( )

clearSectionNavigationPreference() public méthode

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() public static méthode

Take raw permission definitions and create.
public static compilePermissions ( array $rawPermissions ) : array
$rawPermissions array Database rows from the permissions table.
Résultat array Compiled permissions

confirmEmail() public méthode

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.
Résultat boolean Returns **true** if the email was confirmed.

connect() public méthode

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.
Résultat integer The new/existing user ID.

countEstimate() public méthode

Approximate the number of users by checking the database table status.
public countEstimate ( ) : integer
Résultat integer

counts() public méthode

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() public méthode

Decline a user's application to join the forum.
public decline ( integer $UserID ) : boolean
$UserID integer
Résultat boolean

definePermissions() public méthode

Load and compile user permissions
Deprecation: Use UserModel::getPermissions instead.
public definePermissions ( integer $UserID, boolean $Serialize = false ) : array
$UserID integer
$Serialize boolean
Résultat array

delete() public méthode

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

deleteContent() public méthode

Delete a user's content across many contexts.
public deleteContent ( integer $UserID, array $Options = [], array $Content = [] ) : boolean | integer
$UserID integer
$Options array
$Content array
Résultat boolean | integer

deleteID() public méthode

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() public méthode

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.
Résultat array Returns a filtered version of {@link $data}.

fixGender() public static méthode

Force gender to be a verified value.
public static fixGender ( string $Value ) : string
$Value string The gender string.
Résultat string

get() public méthode

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
Résultat object DataSet

getActiveUsers() public méthode

Get the most recently active users.
public getActiveUsers ( integer $Limit = 5 ) : Gdn_DataSet
$Limit integer The number of users to return.
Résultat Gdn_DataSet Returns a list of users.

getApplicantCount() public méthode

Get the current number of applicants waiting to be approved.
public getApplicantCount ( ) : integer
Résultat integer Returns the number of applicants or 0 if the registration method isn't set to approval.

getApplicants() public méthode

Returns all users in the applicant role.
public getApplicants ( ) : Gdn_DataSet
Résultat Gdn_DataSet Returns a data set of the users who are applicants.

getAttribute() public méthode

Get an Attribute from a single user.
public getAttribute ( integer $UserID, string $Attribute, mixed $DefaultValue = false ) : mixed
$UserID integer
$Attribute string
$DefaultValue mixed
Résultat mixed

getAuthentication() public méthode

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.
Résultat array | false

getByEmail() public méthode

Get user by email address.
public getByEmail ( string $Email ) : array | boolean | stdClass
$Email string The email address of the user.
Résultat array | boolean | stdClass Returns the user or **false** if they don't exist.

getByRole() public méthode

Get users by role.
public getByRole ( integer | string $Role ) : Gdn_DataSet
$Role integer | string The ID or name of the role.
Résultat Gdn_DataSet Returns the users with the given role.

getByUsername() public méthode

Get a user by their username.
public getByUsername ( string $Username ) : boolean | object
$Username string The username of the user.
Résultat boolean | object Returns the user or **false** if they don't exist.

getCountLike() public méthode

public getCountLike ( array | boolean $Like = false ) : integer
$Like array | boolean
Résultat integer

getCountWhere() public méthode

public getCountWhere ( array | false $Where = false ) : integer
$Where array | false
Résultat integer

getDefaultAvatarUrl() public static méthode

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).
Résultat string The url to the default avatar image.

getDelete() public méthode

Get rows from a table then delete them.
Since: 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() protected méthode

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.
Résultat string The welcome email for the registration type.

getID() public méthode

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.
Résultat array | object | false Returns the user or **false** if the user wasn't found.

getIDs() public méthode

public getIDs ( array $IDs, boolean $SkipCacheQuery = false ) : array
$IDs array
$SkipCacheQuery boolean
Résultat array

getIPs() public méthode

Retrieve IP addresses associated with a user.
public getIPs ( integer $userID ) : array
$userID integer Unique ID for a user.
Résultat array IP addresses for the user.

getInvitationCount() public méthode

Get number of available invites a user has.
public getInvitationCount ( integer $UserID ) : integer
$UserID integer
Résultat integer

getLike() public méthode

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
Résultat Gdn_DataSet

getMeta() public static méthode

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
Résultat array results or $Default

getPermissions() public méthode

Get a user's permissions.
public getPermissions ( integer $userID ) : Vanilla\Permissions
$userID integer Unique ID of the user.
Résultat Vanilla\Permissions

getPermissionsIncrement() public méthode

getRoles() public méthode

Get the roles for a user.
public getRoles ( integer $userID ) : Gdn_DataSet
$userID integer The user to get the roles for.
Résultat Gdn_DataSet Returns the roles as a dataset (with array values).

getSession() public méthode

public getSession ( integer $UserID, boolean $Refresh = false ) : array | object | false
$UserID integer
$Refresh boolean
Résultat array | object | false

getSummary() public méthode

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
Résultat array | null

getSystemUserID() public méthode

Retrieves a "system user" id that can be used to perform non-real-person tasks.
public getSystemUserID ( ) : integer
Résultat integer Returns a user ID.

getUserFromCache() public méthode

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'
Résultat array | false Returns a user array or **false** if the user isn't in the cache.

givePoints() public static méthode

Add points to a user's total.
Since: 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() public méthode

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() public méthode

To be used for approval registration.
public insertForApproval ( array $FormPostValues, array $Options = [] ) : integer
$FormPostValues array
$Options array
Résultat integer UserID.

insertForBasic() public méthode

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
Résultat boolean | integer | string

insertForInvite() public méthode

To be used for invitation registration.
public insertForInvite ( array $FormPostValues, array $Options = [] ) : integer
$FormPostValues array
$Options array
Résultat integer UserID.

joinUsers() public méthode

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 méthode

protected lookupRoleIDs ( array $Roles ) : array
$Roles array
Résultat array

merge() public méthode

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() protected méthode

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

newUserRoleIDs() public méthode

public newUserRoleIDs ( ) : array
Résultat array

noEmail() public static méthode

Whether or not users have email addresses.
public static noEmail ( ) : boolean
Résultat boolean

passwordRequest() public méthode

Send forgot password email.
public passwordRequest ( string $Email ) : boolean
$Email string
Résultat boolean

passwordReset() public méthode

Do a password reset.
public passwordReset ( integer $UserID, string $Password ) : array | false
$UserID integer
$Password string
Résultat array | false Returns the user or **false** if the user doesn't exist.

pastUserMegaThreshold() public méthode

Whether we're wandered into extreme database optimization territory with our user count.
public pastUserMegaThreshold ( ) : boolean
Résultat boolean

pastUserThreshold() public méthode

This is a useful indication that some database operations on the User table will be painfully long.
public pastUserThreshold ( ) : boolean
Résultat boolean

profileCount() public méthode

Get a user's counter.
public profileCount ( integer | string | object $User, string $Column ) : integer | false
$User integer | string | object
$Column string
Résultat integer | false

rateLimit() public static méthode

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

reduceInviteCount() public méthode

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() public méthode

Register a new user.
public register ( array $FormPostValues, array $Options = [] ) : boolean | integer | string
$FormPostValues array
$Options array
Résultat boolean | integer | string

removePicture() public méthode

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

requireConfirmEmail() public static méthode

Whether or not the application requires email confirmation.
public static requireConfirmEmail ( ) : boolean
Résultat boolean

save() public méthode

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() public méthode

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() public méthode

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

saveAttribute() public méthode

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 méthode

public saveAuthentication ( array $Data ) : Gdn_DataSet | string
$Data array
Résultat Gdn_DataSet | string

saveIP() public méthode

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.
Résultat boolean Was the operation successful?

savePreference() public méthode

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 méthode

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

saveToSerializedColumn() public méthode

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() public méthode

Count search results.
public searchCount ( array | string $Filter = '' ) : integer
$Filter array | string
Résultat integer

sendEmailConfirmationEmail() public méthode

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

sendPasswordEmail() public méthode

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

sendWelcomeEmail() public méthode

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() public méthode

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

setField() public méthode

Set a single user property.
public setField ( integer $RowID, array | string $Property, boolean $Value = false ) : boolean
$RowID integer
$Property array | string
$Value boolean
Résultat boolean

setMeta() public static méthode

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

setTransientKey() public méthode

Set the TransientKey attribute on a user.
public setTransientKey ( integer $UserID, string $ExplicitKey = '' ) : string
$UserID integer
$ExplicitKey string
Résultat string

signinLabelCode() public static méthode

public static signinLabelCode ( ) : string
Résultat string

sso() public méthode

Initiate an SSO connection.
public sso ( string $String, boolean $ThrowError = false ) : integer | void
$String string
$ThrowError boolean
Résultat integer | void

syncUser() public méthode

Sync user data.
Since: 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() public méthode

Sync user data.
Deprecation: since 2.2.
Since: 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() public méthode

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.
Résultat integer The ID of the user.

tagSearch() public méthode

A simple search for tag queries.
Since: 2.2
public tagSearch ( string $Search, integer $Limit = 10 )
$Search string
$Limit integer

unBan() public méthode

Unban a user.
Since: 2.1
public unBan ( integer $UserID, array $Options = [] )
$UserID integer The user to unban.
$Options array Options for the unban.

updateUserCache() public méthode

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

updateVisit() public méthode

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() public méthode

Cache a user.
public userCache ( array $User, $UserID = null ) : boolean
$User array The user to cache.
Résultat boolean Returns **true** if the user was cached or **false** otherwise.

userCacheRoles() public méthode

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.
Résultat boolean Was the caching operation successful?

userQuery() public méthode

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() public méthode

Validate submitted user data.
public validate ( array $FormPostValues, boolean $Insert = false ) : boolean | array
$FormPostValues array
$Insert boolean
Résultat boolean | array

validateCredentials() public méthode

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
Résultat object | false Returns the user matching the credentials or **false** if the user doesn't validate.

validateSpamRegistration() public méthode

Since: 2.1
public validateSpamRegistration ( array $User ) : boolean | string
$User array
Résultat boolean | string

validateUniqueFields() public méthode

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
Résultat array | boolean

Property Details

$SessionColumns public_oe property

public $SessionColumns

$UserMegaThreshold public_oe property

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

$UserThreshold public_oe property

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