__construct()
addFetchOptionJoin()
addPositionLimit()
addUserGroupChange()
assertValidCutOffOperator()
ban()
canBypassUserPrivacy()
canReportContent()
canStartConversationWithUser()
canStartConversations()
canViewIps()
canViewUserOnlineStatus()
canViewWarnings()
canWarnUser()
couldBeEmail()
couldBeSpammer()
countTotalUsers()
countUsers()
countUsersFollowingUserId()
create()
deleteSessionActivity()
fetchAllKeyed()
follow()
getAllUsers()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getEarliestRegistrationDate()
getFollowRecord()
getFollowedUserProfiles()
getFollowingDenormalizedValue()
getFullUserById()
getLatestUser()
getLatestUsers()
getModelFromCache()
getMostActiveUsers()
getOrderByClause()
getRegistrationIps()
getUnreadAlertsCount()
getUserAuthenticationObjectByUserId()
getUserAuthenticationRecordByUserId()
getUserByEmail()
getUserById()
getUserByName()
getUserByNameOrEmail()
getUserGroupChangesForUser()
getUserIdFromUser()
getUserIdsInRange()
getUsers()
getUsersByIds()
getUsersByIp()
getUsersByNames()
getUsersFollowingUserId()
getVisitingGuestUser()
getVisitingUserById()
isFollowing()
isMemberOfUserGroup()
isUserIgnored()
isUserSuperAdmin()
liftBan()
limitQueryResults()
loginUserByRememberCookie()
loginUserByRememberKeyFromCookie()
passesPrivacyCheck()
prepareLimitFetchOptions()
prepareRememberKeyForCookie()
prepareStateLimitFromConditions()
prepareUser()
prepareUserCard()
prepareUserCards()
prepareUserConditions()
prepareUserFetchOptions()
prepareUserOrderOptions()
rebuildCustomFieldCache()
rebuildUserModerationQueueCache()
removeDuplicateFollowUserIds()
removeUserGroupChange()
removeUserGroupChangeLogByKey()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
setPermissionsFromUserId()
setPermissionsOnVisitorArray()
setUserRememberCookie()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unfollow()
unserializePermissionsInList()
update()
updateFollowingDenormalizedValue()
updateSessionActivity()
validateAuthentication()
_applyUserGroupChanges()
_getCache()
_getDataRegistryModel()
_getDb()
_getFieldModel()
_getIpModel()
_getLocalCacheData()
_getUserProfileModel()
$defaultAdminGroupId
$defaultGuestGroupId
$defaultModeratorGroupId
$defaultRegisteredGroupId
$guestPermissionCombinationId
$_allowCachedRead
$_cache
$_db
$_ignoreCache
$_localCacheData
$_modelCache
FETCH_LAST_ACTIVITY
FETCH_USER_FULL
FETCH_USER_OPTION
FETCH_USER_PERMISSIONS
FETCH_USER_PRIVACY
FETCH_USER_PROFILE
PERMANENT_BAN
Model for users.
Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.
package | XenForo_Users |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
It no limit value is specified, nothing will be returned.
This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.
inherited_from | \XenForo_Model::addPositionLimit() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededaddUserGroupChange(integer $userId, string $key, string | array $addGroups) : boolean
integer
string
Unique identifier for change set
string
array
Comma delimited string or array of user groups to add
boolean
True on change successassertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
ban(integer $userId, integer $endDate, $reason, $update, $errorKey, array $viewingUser) : boolean
integer
ID of user to ban
integer
Date at which ban will be lifted. Use XenForo_Model_User::PERMANENT_BAN for a permanent ban.
boolean
canBypassUserPrivacy(string $errorPhraseKey, array $viewingUser) : boolean
string
array
boolean
canReportContent(string $errorPhraseKey, array $viewingUser) : boolean
string
array
null
boolean
canStartConversationWithUser(array $user, string $errorPhraseKey, array $viewingUser) : boolean
Does not check standard conversation permissions.
array
string
array
null
boolean
canStartConversations(string $errorPhraseKey, array $viewingUser) : boolean
string
array
null
boolean
canViewIps(string $errorPhraseKey, array $viewingUser) : boolean
string
array
null
boolean
canViewUserOnlineStatus(array $user, string $errorPhraseKey, array $viewingUser) : boolean
array
User being viewed
string
Returned by ref. Phrase key of more specific error
array
null
Viewing user ref
boolean
canViewWarnings(string $errorPhraseKey, array $viewingUser) : boolean
string
array
null
boolean
canWarnUser(array $user, string $errorPhraseKey, array $viewingUser) : boolean
array
User being viewed
string
Returned by ref. Phrase key of more specific error
array
null
Viewing user ref
boolean
couldBeEmail(String $email) : boolean
String
boolean
couldBeSpammer(array $user, string | array $errorKey) : boolean
array
string
array
Error phrase key - may become an array if the phrase requires parameters
boolean
countTotalUsers() : integer
integer
countUsers(array $conditions) : array
array
array
Format: [user id] => user infocountUsersFollowingUserId(integer $userId) : array
integer
array
Format: [user id] => following user infocreate(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
deleteSessionActivity(integer $userId, string $ip)
integer
string
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)
Note that the specified key must exist in the query result, or it will be ignored.
inherited_from | \XenForo_Model::fetchAllKeyed() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
follow(array $followUsers, boolean $dupeCheck, array $user) : string
array
Users being followed
boolean
Check for and prevent duplicate followers
array
User doing the following
string
Comma-separated list of all users now being followed by $userIdgetAllUsers(array $fetchOptions) : array
Can be restricted to valid users only with the validOnly fetch option.
array
User fetch options
array
Format: [user id] => user infogetConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetEarliestRegistrationDate() : integer
integer
getFollowRecord(integer | array $userId, integer | array $followUserId) : array
integer
array
integer
array
array
getFollowedUserProfiles($userId, integer $maxResults, string $orderBy) : array
integer
(0 = all)
string
array
getFollowingDenormalizedValue($userId) : string
string
getFullUserById(integer $userId, array $fetchOptions) : array | false
Equivalent to calling getUserById including the FETCH_USER_FULL constanct
integer
array
User fetch options
array
false
getLatestUser() : array | false
array
false
getLatestUsers(array $criteria, array $fetchOptions) : array
array
array
array
User recordsgetModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getMostActiveUsers(array $criteria, array $fetchOptions) : array
array
array
array
User recordsgetOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetRegistrationIps(integer $userId) : array
integer
array
[ register: string, account-confirmation: string ]getUnreadAlertsCount(integer $userId) : integer
integer
integer
getUserAuthenticationObjectByUserId(integer $userId) : \XenForo_Authentication_Abstract | false
getUserAuthenticationRecordByUserId(integer $userId) : array | false
integer
array
false
getUserByEmail(string $email, array $fetchOptions) : array | false
string
array
User fetch options
array
false
getUserById(integer $userId, array $fetchOptions) : array | false
integer
array
User fetch options
array
false
getUserByName(string $username, array $fetchOptions) : array | false
string
array
User fetch options
array
false
getUserByNameOrEmail(string $input, array $fetchOptions) : array | false
string
array
User fetch options
array
false
getUserGroupChangesForUser(integer $userId) : array
integer
array
[change key] => comma list of group IDsgetUserIdFromUser($user) : integer
integer
User IDgetUserIdsInRange(integer $start, integer $limit) : array
integer
Find users with user_id greater than...
integer
Maximum users to return at once
array
getUsers(array $conditions, array $fetchOptions) : array
array
array
array
Format: [user id] => user infogetUsersByIds(array $userIds, array $fetchOptions) : array
array
array
array
Format: [user id] => user infogetUsersByIp(string $ip, array $fetchOptions) : array
string
array
array
Format: [user id] => user infogetUsersByNames(array $usernames, array $fetchOptions, array $invalidNames) : array
array
array
User fetch options
array
Returns a list of usernames that could not be found
array
Format: [user id] => infogetUsersFollowingUserId(integer $userId, integer $maxResults, string $orderBy) : array
integer
integer
(0 = all)
string
array
Format: [user id] => following user infogetVisitingGuestUser() : array
array
getVisitingUserById(integer $userId) : array
integer
array
isFollowing(integer $userId, array $follower) : boolean
integer
User being followed
array
User doing the following
boolean
isMemberOfUserGroup(array $user, integer | array $userGroupId, boolean $includeSecondaryGroups) : boolean
array
integer
array
either a single user group ID or an array thereof
boolean
Also check secondary groups
boolean
isUserIgnored(array $user, integer | string $ignoredUser) : array | boolean
array
integer
string
User ID or user name
array
boolean
isUserSuperAdmin(array $user)
liftBan(integer $userId) : boolean
integer
boolean
limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessaryloginUserByRememberCookie(string $userCookie) : false | integer
string
false
integer
loginUserByRememberKeyFromCookie(integer $userId, string $rememberKey, array | false | null $auth) : boolean
integer
string
array
false
null
User's auth record (retrieved if null)
boolean
passesPrivacyCheck(string $privacyRequirement, array $user, array $viewingUser) : \unknown_type
This must include the following status for the viewing user.
string
The required privacy: everyone, none, members, followed
array
User info, including following status for viewing user
array
null
Viewing user ref
\unknown_type
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareRememberKeyForCookie(string $rememberKey) : string
string
Key from DB
string
prepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit stateprepareUser(array $user) : array
Note that this may be called on incomplete guest records.
array
User info
array
Prepared user infoprepareUserCard(array $user) : array
array
array
prepareUserCards(array $users) : array
array
array
prepareUserConditions(array $conditions, array $fetchOptions) : string
array
List of conditions. (TODO: make list)
array
The fetch options that have been provided. May be edited if criteria requires.
string
Criteria as SQL for where clauseprepareUserFetchOptions(array $fetchOptions) : array
array
array
Containing 'selectFields' and 'joinTables' keys.prepareUserOrderOptions(array $fetchOptions, string $defaultOrderSql) : string
array
(uses 'order' key)
string
Default order SQL
string
rebuildCustomFieldCache(integer $userId)
integer
rebuildUserModerationQueueCache() : array
array
Cache, [total, lastModifiedDate]removeDuplicateFollowUserIds(integer $userId, array $newUsers, string $existingUserIds) : array
integer
array
(full user arrays)
string
'3,6,42,....'
array
removeUserGroupChange(integer $userId, string $key) : boolean
integer
string
Change set key
boolean
True on successremoveUserGroupChangeLogByKey($key)
resetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
This should only be used if you know what you're doing or for testing purposes!
Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)
inherited_from | \XenForo_Model::setLocalCacheData() |
---|
string
setPermissionsFromUserId(array $userInfo, integer $permUserId) : array
array
integer
array
User info with changed permissionssetPermissionsOnVisitorArray(array $userinfo, $permissionCombinationId) : array
Defaults to setting guest permissions.
array
Visitor record
array
Visitor record with permissionssetUserRememberCookie(integer $userId, array | false | null $auth) : boolean
integer
array
false
null
User's auth record (retrieved if null)
boolean
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.
inherited_from | \XenForo_Model::standardizeViewingUserReference() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unfollow(integer $followUserId, integer $userId) : string
integer
User being followed
integer
User doing the following
string
Comma-separated list of all users now being followed by $userIdunserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserializedupdate($user, array | string $field, mixed $value) : \XenForo_DataWriter_User
array
string
Either the name of a single field, or an array of field-name => field-value pairs
mixed
If the previous parameter is a string, use this as the field value
updateFollowingDenormalizedValue($userId, string $following) : string
Will query for the value if it is not provided
string
Denormalized following value
string
updateSessionActivity(integer $userId, string $ip, string $controllerName, string $action, string $viewState, array $inputParams, integer | null $viewDate)
integer
string
IP of visiting user
string
Last controller class that was invoked
string
Last action that was invoked
string
Either "valid" or "error"
array
List of special input params, to include to help get more info on current activity
integer
null
The timestamp of the last page view; defaults to now
validateAuthentication(string $nameOrEmail, string $password, string $error) : integer | false
Exceptions are thrown on errors.
string
User name or email address
string
string
Error string (by ref)
integer
false
User ID auth'd as; false on failure_applyUserGroupChanges(integer $userId, array $oldGroupStrings, array $newGroupStrings) : boolean
integer
array
Array of comma-delimited strings of existing (accounted for) user group change sets
array
Array of comma-delimited strings for new list of user group change sets
boolean
_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
$defaultAdminGroupId
$defaultGuestGroupId
$defaultModeratorGroupId
$defaultRegisteredGroupId
$guestPermissionCombinationId
$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_ignoreCache : array
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|
FETCH_LAST_ACTIVITY
FETCH_USER_FULL : integer
FETCH_USER_OPTION
FETCH_USER_PERMISSIONS
FETCH_USER_PRIVACY
FETCH_USER_PROFILE
PERMANENT_BAN : integer