vB_User
in package
Uses
vB_Trait_NoSerialize
Table of Contents
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- calcUsertimeDiff() : mixed
- clearUsersCache() : mixed
- Clears user cached information.
- doShowDisplaynameAndUsername() : bool
- Returns true if enabledisplayname is on or if enabledisplayname is off but username & displayname are not equivalent. Used for templates that cannot run certain functions required perform this check.
- execStrikeUser() : mixed
- execUnstrikeUser() : mixed
- expandOptions() : mixed
- fetchMusername() : string
- fetches the proper username markup and title
- fetchUserinfo() : array<string|int, mixed>
- Fetches an array containing info for the specified user, or false if user is not found
- getBaseUsers() : mixed
- getEmailUserLabel() : string
- Generate the user label for use in emails. E.g. "Display Name (username)". Note, this returns html-escaped data for use in html emails.
- getUserCacheKey() : mixed
- getUserInfoByCredential() : mixed
- Obtains user info depending on the login credentials method.
- processLogout() : info
- Logs the current user out
- processNewLogin() : array<string|int, mixed>
- Processes logins into CP THIS METHOD DOES NOT SET ANY COOKIES, SO IT CANNOT REPLACE DIRECTLY THE LEGACY FUNCTION
- setAdminCss() : mixed
- setGroupInTopic() : bool
- This grants a user additional permissions in a specific channel, by adding to the groupintopic table
- verifySecurityToken() : bool
- Verifies a security token is valid
- verifyStrikeStatus() : mixed
- Verifies that the user hasn't exceeded the strike total for attempted logins. Based both on user name and IP address.
Methods
__serialize()
public
__serialize() : array<string|int, mixed>
Return values
array<string|int, mixed>__sleep()
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__unserialize()
public
__unserialize(array<string|int, mixed> $serialized) : void
Parameters
- $serialized : array<string|int, mixed>
__wakeup()
public
__wakeup() : void
calcUsertimeDiff()
public
static calcUsertimeDiff(mixed $userinfo) : mixed
Parameters
- $userinfo : mixed
clearUsersCache()
Clears user cached information.
public
static clearUsersCache(mixed $userid) : mixed
Parameters
- $userid : mixed
doShowDisplaynameAndUsername()
Returns true if enabledisplayname is on or if enabledisplayname is off but username & displayname are not equivalent. Used for templates that cannot run certain functions required perform this check.
public
static doShowDisplaynameAndUsername(array<string|int, mixed> $user) : bool
Parameters
- $user : array<string|int, mixed>
-
User info array, e.g. from fetchUserinfo()
Return values
boolexecStrikeUser()
public
static execStrikeUser([mixed $username = '' ]) : mixed
Parameters
- $username : mixed = ''
execUnstrikeUser()
public
static execUnstrikeUser(mixed $username) : mixed
Parameters
- $username : mixed
expandOptions()
public
static expandOptions(mixed &$user) : mixed
Parameters
- $user : mixed
fetchMusername()
fetches the proper username markup and title
public
static fetchMusername(array<string|int, mixed> &$user[, string $displaygroupfield = 'displaygroupid' ][, string $usernamefield = 'displayname' ]) : string
Parameters
- $user : array<string|int, mixed>
-
(ref) User info array
- $displaygroupfield : string = 'displaygroupid'
-
Name of the field representing displaygroupid in the User info array
- $usernamefield : string = 'displayname'
-
Name of the field representing username in the User info array
Return values
string —Username with markup and title
fetchUserinfo()
Fetches an array containing info for the specified user, or false if user is not found
public
static fetchUserinfo([mixed $userid = 0 ][, mixed $option = [] ][, mixed $languageid = false ][, mixed $nocache = false ]) : array<string|int, mixed>
Values for Option parameter: avatar - Get avatar admin - Join the administrator table to get various admin options signpic - Join the sigpic table to get the userid just to check if we have a picture usercss - Get user's custom CSS isfriend - Is the logged in User a friend of this person? Therefore: ['avatar', 'location'] means 'Get avatar' and 'Process online location'
Parameters
- $userid : mixed = 0
- $option : mixed = []
- $languageid : mixed = false
- $nocache : mixed = false
Return values
array<string|int, mixed> —The information for the requested user
getBaseUsers()
public
static getBaseUsers(mixed $userids, mixed $option) : mixed
Parameters
- $userids : mixed
- $option : mixed
getEmailUserLabel()
Generate the user label for use in emails. E.g. "Display Name (username)". Note, this returns html-escaped data for use in html emails.
public
static getEmailUserLabel(int|array<string|int, mixed> $userOrId) : string
Parameters
- $userOrId : int|array<string|int, mixed>
-
Either int userid or array with 'username' and 'displayname'.
Return values
stringgetUserCacheKey()
public
static getUserCacheKey(mixed $userid, mixed $option, mixed $languageid) : mixed
Parameters
- $userid : mixed
- $option : mixed
- $languageid : mixed
getUserInfoByCredential()
Obtains user info depending on the login credentials method.
public
static getUserInfoByCredential( $credential) : mixed
Parameters
processLogout()
Logs the current user out
public
static processLogout() : info
This function does not remove the session cookies
Return values
info —array: sessionhash -- hash identifying the new session apiaccesstoken -- the current api access token, if this is a request through MAPI
processNewLogin()
Processes logins into CP THIS METHOD DOES NOT SET ANY COOKIES, SO IT CANNOT REPLACE DIRECTLY THE LEGACY FUNCTION
public
static processNewLogin(array<string|int, mixed> $auth[, string $logintype = '' ]) : array<string|int, mixed>
Parameters
- $auth : array<string|int, mixed>
-
-- userid/password (remembeme value)
- $logintype : string = ''
-
Currently 'cplogin' only or empty
Tags
Return values
array<string|int, mixed> —The $auth parameter with the addition of sessionhash -- hash identifying the new session cpsessionhash -- the hash for the cp session (only present if the user is an admin or a mod) lastvisit -- session lastvisit lastactivity -- session lastactivity
setAdminCss()
public
static setAdminCss(mixed $userid, mixed $cssprefs) : mixed
Parameters
- $userid : mixed
- $cssprefs : mixed
setGroupInTopic()
This grants a user additional permissions in a specific channel, by adding to the groupintopic table
public
static setGroupInTopic(mixed $userid, mixed $nodeids, mixed $usergroupid) : bool
Parameters
- $userid : mixed
- $nodeids : mixed
- $usergroupid : mixed
Return values
boolverifySecurityToken()
Verifies a security token is valid
public
static verifySecurityToken(mixed $request_token, mixed $user_token) : bool
Parameters
- $request_token : mixed
- $user_token : mixed
Return values
bool —True if the hash matches and is within the correct TTL
verifyStrikeStatus()
Verifies that the user hasn't exceeded the strike total for attempted logins. Based both on user name and IP address.
public
static verifyStrikeStatus([string $username = '' ]) : mixed
Parameters
- $username : string = ''