vB_Api_User
extends vB_Api
in package
vB_Api_User
Table of Contents
Constants
- USERINFO_ADMIN = 'admin'
- USERINFO_AVATAR = 'avatar'
- USERINFO_AVATAR_DATA = 'avatardata'
- USERINFO_AVATAR_INFO = 'avatarinfo'
- USERINFO_ISFRIEND = 'isfriend'
- USERINFO_SIGNPIC = 'signpic'
Methods
- __serialize() : array<string|int, mixed>
- __sleep() : array<string|int, mixed>
- __unserialize() : void
- __wakeup() : void
- activateUser() : string
- Activate an user with an activate ID
- activateUserByUsername() : string
- Activate an user with an activate ID and Username
- banUsers() : mixed
- Ban users
- callNamed() : The
- Call the given api function by name with a named arguments list.
- canCreateBlogEntry() : 1
- Tells whether the current user can create a blog entry. That can be their own permissions or GIT.
- canEditDisplayname() : array{caneditdisplayname: bool}
- Check if the current user can change/display their displayname.
- canRemovePost() : int
- Checks the various options as to whether the current user can physically remove a post
- changeUserRelation() : mixed
- checkApiState() : mixed
- This method checks whether the API method is enabled.
- checkPrivacyOption() : mixed
- checkUsername() : bool
- This checks whether the a username is available and valid
- clearCache() : mixed
- Clears all previously loaded API objects.
- clearChannelPerms() : mixed
- This method clears remembered channel permission
- clearFlagForDelete() : mixed
- currentUserHasAdminPermission() : mixed
- delete() : mixed
- Delete a user
- deleteActivation() : mixed
- doShowDisplaynameAndUsername() : mixed
- 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.
- emailPassword() : success
- Email user a password reset email
- enableMfa() : mixed
- Enable the user's current MFA record after verify password and authcode
- fetchAdminUser() : mixed
- This implements vB_PermissionContext::getAdminUser().
- fetchAvatar() : array<string|int, mixed>
- Fetches the URL for a User's Avatar
- fetchAvatars() : array<string|int, mixed>
- Fetch the Avatars for a userid array
- fetchAwaitingModerate() : array<string|int, mixed>
- Fetch a list of users who are awaiting moderate or Coppa
- fetchBirthdays() : array<string|int, mixed>
- Fetch today's birthdays
- fetchByEmail() : array<string|int, mixed>
- Fetch user by its email
- fetchByUsername() : array<string|int, mixed>
- Fetch user by its username
- fetchCurrentUserinfo() : array<string|int, mixed>
- Fetches an array containing info for the current user
- fetchMusername() : string
- fetches the proper username markup and title
- fetchProfileFieldsForRegistration() : array<string|int, mixed>
- Fetches the Profile Fields that needs to be displayed in Registration From
- fetchProfileInfo() : array<string|int, mixed>
- This gets the information needed for a user's profile. Only public information unless this is an admin or the user.
- fetchPruneUsers() : array<string|int, mixed>
- Return a list of users for pruning or moving
- fetchReferrers() : array<string|int, mixed>
- Return a report of referrers
- fetchSignature() : array<string|int, mixed>|false
- Get the profile information so the presentation can render it
- fetchTimeOffset() : int
- Adjust GMT time back to user's time Use "gm" versions of date/time functions with this offset, not ones that rely on current server's system timezone.
- fetchUserinfo() : array<string|int, mixed>
- Fetches an array containing info for the specified user, or false if user is not found
- fetchUserName() : string
- Fetches the username for a userid, or false if user is not found
- fetchUsernames() : array<string|int, mixed>
- Returns an array with the usernames for the user ids and optionally the profileUrl for the user
- fetchUserProfileFields() : array<string|int, mixed>
- This gets the current user profile fields from the database.
- fetchUserSettings() : mixed
- Fetches the needed info for user settings
- fetchUsersPms() : array<string|int, mixed>
- Fetch private messages statistics from all the users.
- find() : bool|array<string|int, mixed>
- Find user
- generateMailingList() : bool|array<string|int, mixed>
- Generates users mailing list for the given criteria.
- getApiClassName() : mixed
- getAutocomplete() : array<string|int, mixed>
- Returns suggested usernames for the username autocomplete popup menu.
- getCanCreate() : array<string|int, mixed>
- This is a wrapper for userContext getCanCreate- it returns the content types a user can create
- getGitCanStart() : array<string|int, mixed>
- This likes the channels below a parent node where a user can create starters based on groupintopic
- getGroupInTopic() : array<string|int, mixed>
- This returns a user's additional permissions from the groupintopic table
- getIpLocation() : mixed
- Return the location for the current user's IP address
- getNamecardInfo() : mixed
- getNamecardInfoBulk() : mixed
- getPersonalData() : array<string|int, mixed>
- Returns a report on "personal information" for a user
- getUsersFromCriteria() : array<string|int, mixed>
- Fetch users and info from a given user criteria Used for admincp - verticalresponse.
- hasPermissions() : bool|int
- Returns global permission value or specific value for a nodeid for current user.
- havePermissions() : bool|int
- Returns permission values of a group of nodes for current user.
- ignoreUser() : mixed
- instance() : vB_Api
- Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
- instanceInternal() : vB_Api
- Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
- inviteMembers() : mixed
- Invites members to a given node channel passing either an array of userids or usernames.
- isBanned() : bool
- Check whether a user is banned.
- isBannedEmail() : bool
- Check whether an email address is banned from the forums
- isIgnoringUser() : mixed
- isMfaEnabled() : mixed
- Gets whether or not the user has an enabled MFA record
- killActivation() : mixed
- login() : array<string|int, mixed>
- Login a user
- login2() : array<string|int, mixed>
- Login a user
- loginExternal() : mixed
- Log in via a third party provider.
- loginSpecificUser() : array<string|int, mixed>
- Login a user for which we have the userid
- logout() : bool
- Logout user
- logoutAllDevices() : array{success: bool, sessionhash: string, apiaccesstoken: string}
- Logout user from all devices.
- map_vb4_input_to_vb5() : string
- Returns vb5 api method name.
- map_vb5_errors_to_vb4() : mixed
- Alters the error array in any way necessary to interface correctly with vb4.
- map_vb5_output_to_vb4() : mixed
- Alters the output array in any way necessary to interface correctly with vb4.
- memberList() : array<string|int, mixed>
- Fetch a list of user based on the provided criteria
- merge() : mixed
- Merge two users
- needMFA() : array<string|int, mixed>
- Indicates if the current user needs to provide an MFA code for login.
- needsCoppa() : int
- This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call
- prune() : mixed
- Do prune/move users (step 1)
- registerNeedAvatarForUsers() : mixed
- Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.
- resetMfaSecret() : mixed
- Reset the current user's MFA secret
- save() : int
- Insert or Update an user
- saveEditorState() : array<string|int, mixed>
- Saves the content entry UI editor "state" where state is the show/hide state of the following 3 content entry UIs: ckeditor toolbar, attachements panel, and smilies panel.
- saveProfileFieldDefinition() : mixed
- saveSignature() : string
- Verifies and saves a signature for current logged in user. Returns the signature.
- searchIP() : array<string|int, mixed>
- Search IP Addresses
- searchUsersByIP() : array<string|int, mixed>
- Search IP Addresses
- sendActivateEmail() : mixed
- setCurrentUserPrivacyConsent() : mixed
- Set privacy consent and for the current user if needed.
- setDefaultAvatar() : mixed
- This sets a user to use one of the default avatars.
- setGroupInTopic() : bool
- This grants a user additional permissions in a specific channel, by adding to the groupintopic table
- setMfaEnabled() : mixed
- Sets the users MFA record to enabled or disabled
- setNewPassword() : array<string|int, string>
- Set a new password for a user. Used by "forgot password" function.
- unixtimestampToUserDateString() : mixed
- unsetGroupInTopic() : bool
- This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table
- updateGuestPrivacyConsent() : mixed
- Updates guest privacy consent
- updateStatus() : string
- Updates the user status
- useCoppa() : bool
- This checks whether the site uses COPPA review
- userTimeStrToUnixtimestamp() : mixed
- vBMktime() : int
- translate a year/month/day/hour/minute to a Unix timestamp.
- verifyFlashMessageSignature() : array<string|int, mixed>
- Verifies that a flash message passed through the URL is signed and valid
Constants
USERINFO_ADMIN
public
mixed
USERINFO_ADMIN
= 'admin'
USERINFO_AVATAR
public
mixed
USERINFO_AVATAR
= 'avatar'
USERINFO_AVATAR_DATA
public
mixed
USERINFO_AVATAR_DATA
= 'avatardata'
USERINFO_AVATAR_INFO
public
mixed
USERINFO_AVATAR_INFO
= 'avatarinfo'
USERINFO_ISFRIEND
public
mixed
USERINFO_ISFRIEND
= 'isfriend'
USERINFO_SIGNPIC
public
mixed
USERINFO_SIGNPIC
= 'signpic'
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
activateUser()
Activate an user with an activate ID
public
activateUser(int $userid, string $activateid) : string
Parameters
- $userid : int
-
User ID
- $activateid : string
-
Activate ID
Tags
Return values
string —User status after activation. Possible values:
- moderateuser: user is put into moderate queue
- emailchanged: user's email address has been updated successfully
- registration_complete: user's registration is completed
activateUserByUsername()
Activate an user with an activate ID and Username
public
activateUserByUsername(string $username, string $activateid) : string
Parameters
- $username : string
-
Username
- $activateid : string
-
Activate ID
Tags
Return values
string —User status after activation. Possible values:
- moderateuser: user is put into moderate queue
- emailchanged: user's email address has been updated successfully
- registration_complete: user's registration is completed
banUsers()
Ban users
public
banUsers(array<string|int, mixed> $userids, int $banusergroupid, string $period[, string $reason = '' ]) : mixed
Parameters
- $userids : array<string|int, mixed>
-
Userids to ban
- $banusergroupid : int
-
Which banned usergroup to move the users to
- $period : string
-
Ban period
- $reason : string = ''
-
Ban reason
callNamed()
Call the given api function by name with a named arguments list.
public
callNamed() : The
Used primarily to translate REST requests into API calls.
Return values
The —return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.
canCreateBlogEntry()
Tells whether the current user can create a blog entry. That can be their own permissions or GIT.
public
canCreateBlogEntry([int $nodeid = 0 ]) : 1
Parameters
- $nodeid : int = 0
-
-- optional. If not passed will check the global blog channel.
Return values
1 —if the user can create a entry in the given channel. 0 otherwise
canEditDisplayname()
Check if the current user can change/display their displayname.
public
canEditDisplayname() : array{caneditdisplayname: bool}
Return values
array{caneditdisplayname: bool}canRemovePost()
Checks the various options as to whether the current user can physically remove a post
public
canRemovePost(int $nodeid) : int
Parameters
- $nodeid : int
Return values
int —0 or 1
changeUserRelation()
public
changeUserRelation(mixed $userid, mixed $action) : mixed
Parameters
- $userid : mixed
- $action : mixed
checkApiState()
This method checks whether the API method is enabled.
public
checkApiState(mixed $method) : mixed
For extensions check make sure $controller property is already set.
Parameters
- $method : mixed
checkPrivacyOption()
public
checkPrivacyOption(mixed $option) : mixed
Parameters
- $option : mixed
checkUsername()
This checks whether the a username is available and valid
public
checkUsername(mixed $candidate) : bool
Parameters
- $candidate : mixed
Return values
boolclearCache()
Clears all previously loaded API objects.
public
static clearCache() : mixed
Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.
clearChannelPerms()
This method clears remembered channel permission
public
clearChannelPerms(mixed $userid) : mixed
Parameters
- $userid : mixed
clearFlagForDelete()
public
clearFlagForDelete() : mixed
currentUserHasAdminPermission()
public
currentUserHasAdminPermission(mixed $adminPermission) : mixed
Parameters
- $adminPermission : mixed
delete()
Delete a user
public
delete(mixed $userid[, mixed $transfer_groups = true ]) : mixed
Parameters
- $userid : mixed
- $transfer_groups : mixed = true
deleteActivation()
public
deleteActivation(mixed $userid, mixed $activateid) : mixed
Parameters
- $userid : mixed
- $activateid : 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
doShowDisplaynameAndUsername(array<string|int, mixed> $user) : mixed
Parameters
- $user : array<string|int, mixed>
-
User info array, e.g. from fetchUserinfo()
Tags
emailPassword()
Email user a password reset email
public
emailPassword(int $userid, string $email[, array<string|int, mixed> $hvinput = [] ]) : success
Parameters
- $userid : int
-
User ID
- $email : string
-
Email address
- $hvinput : array<string|int, mixed> = []
-
Human Verify input data. @see vB_Api_Hv::verifyToken()
Return values
success —array
enableMfa()
Enable the user's current MFA record after verify password and authcode
public
enableMfa(string $password, string $mfa_authcode) : mixed
Parameters
- $password : string
-
-- the user's current password
- $mfa_authcode : string
-
-- the authcode for the current secret, not required if the user does not currently have an auth secret
fetchAdminUser()
This implements vB_PermissionContext::getAdminUser().
public
fetchAdminUser() : mixed
return int User id from a user that can administer the admincp
fetchAvatar()
Fetches the URL for a User's Avatar
public
fetchAvatar(int $userid[, string|bool $typekey = false ][, array<string|int, mixed> $userinfo = [] ]) : array<string|int, mixed>
Parameters
- $userid : int
- $typekey : string|bool = false
- $userinfo : array<string|int, mixed> = []
-
-- Array of userinfo, possibly already containing the avatar information
Return values
array<string|int, mixed> —Information regarding the avatar
fetchAvatars()
Fetch the Avatars for a userid array
public
fetchAvatars([array<string|int, mixed> $userids = [] ][, string|bool $typekey = false ][, array<string|int, mixed> $userinfo = [] ]) : array<string|int, mixed>
Parameters
- $userids : array<string|int, mixed> = []
- $typekey : string|bool = false
- $userinfo : array<string|int, mixed> = []
-
-- array of $userid => userinfo, possibly already containing the avatar information
Return values
array<string|int, mixed> —Information regarding the avatar
fetchAwaitingModerate()
Fetch a list of users who are awaiting moderate or Coppa
public
fetchAwaitingModerate() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of users that are awaiting moderation
fetchBirthdays()
Fetch today's birthdays
public
fetchBirthdays() : array<string|int, mixed>
Return values
array<string|int, mixed> —birthday information
fetchByEmail()
Fetch user by its email
public
fetchByEmail(string $email[, array<string|int, mixed> $option = [] ]) : array<string|int, mixed>
Parameters
- $email : string
-
Email
- $option : array<string|int, mixed> = []
-
Fetch Option (see description of fetchUserinfo())
Return values
array<string|int, mixed> —The information for the requested user
fetchByUsername()
Fetch user by its username
public
fetchByUsername(string $username[, array<string|int, mixed> $option = [] ]) : array<string|int, mixed>
Parameters
- $username : string
-
Username
- $option : array<string|int, mixed> = []
-
Fetch Option (see description of fetchUserinfo())
Return values
array<string|int, mixed> —The information for the requested user
fetchCurrentUserinfo()
Fetches an array containing info for the current user
public
fetchCurrentUserinfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —The information for the requested user. Userinfo record plus language information
fetchMusername()
fetches the proper username markup and title
public
fetchMusername(array<string|int, mixed> $user[, string $displaygroupfield = 'displaygroupid' ][, string $usernamefield = 'displayname' ]) : string
Parameters
- $user : array<string|int, mixed>
-
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
fetchProfileFieldsForRegistration()
Fetches the Profile Fields that needs to be displayed in Registration From
public
fetchProfileFieldsForRegistration([array<string|int, mixed> $userinfo = [] ]) : array<string|int, mixed>
Parameters
- $userinfo : array<string|int, mixed> = []
-
User information as fields' current value
Return values
array<string|int, mixed> —Profile fields
fetchProfileInfo()
This gets the information needed for a user's profile. Only public information unless this is an admin or the user.
public
fetchProfileInfo([int $userid = false ]) : array<string|int, mixed>
Parameters
- $userid : int = false
-
-- uses the current logged in user if not given. Error if the user is a guest.
Return values
array<string|int, mixed> —-- the profile information.
fetchPruneUsers()
Return a list of users for pruning or moving
public
fetchPruneUsers(int $usergroupid, mixed $includeSecondary, int $daysprune, int $minposts, array<string|int, mixed> $joindate, string $order[, int $page = 0 ][, int $perpage = 0 ]) : array<string|int, mixed>
Parameters
- $usergroupid : int
-
Usergroup where the users are in. -1 means all usergroups
- $includeSecondary : mixed
- $daysprune : int
-
Has not logged on for x days, 0 mean any
- $minposts : int
-
Posts is less than, 0 means any
- $joindate : array<string|int, mixed>
-
Join Date is Before. It's an array of 'month', 'day' and 'year'. Array means any
- $order : string
-
Order by one of the following: 'username', 'email', 'usergroup', 'posts', 'lastactivity', 'joindate'. Default: 'username'
- $page : int = 0
-
[optional] used with $perpage, resulting users limit offset
- $perpage : int = 0
-
[optional] used with $page, resulting users limit rows
Return values
array<string|int, mixed> —['users' => array, 'count' => int] : 'users' => Users to be pruned or moved, 'count' => total users count (for pagination when using $page & $perpage)
fetchReferrers()
Return a report of referrers
public
fetchReferrers(array<string|int, mixed> $startdate, array<string|int, mixed> $enddate) : array<string|int, mixed>
This function has been moved to the ReferUser API and will be removed from the User API in a future version.
Parameters
- $startdate : array<string|int, mixed>
-
Start Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'
- $enddate : array<string|int, mixed>
-
End Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'
Return values
array<string|int, mixed> —Referrers information
fetchSignature()
Get the profile information so the presentation can render it
public
fetchSignature(mixed $userid) : array<string|int, mixed>|false
Parameters
- $userid : mixed
Return values
array<string|int, mixed>|false —sigature information or false if there is an error or the user doesn't have a sigature. If the user is not permitted to have a signature, then they will be treated as not having one even if it doesn't exist. signature permissions dohtml dobbcode dobbimagecode dosmilies sigpic sigpicrevision sigpicdateline
fetchTimeOffset()
Adjust GMT time back to user's time Use "gm" versions of date/time functions with this offset, not ones that rely on current server's system timezone.
public
fetchTimeOffset([int $userid = false ][, bool $ignoreDST = false ]) : int
Parameters
- $userid : int = false
-
(Optional) If skipped, will use current user's offset. If provided, will use that user's offset.
- $ignoreDST : bool = false
-
(Optional) Default false. Normally, if daylight savings time is active (either for the user or on the server) this function adds 1 hour to the offset to account for it. E.g. A California user would normally have their timezone set to GMT-0800, but it needs to be -0700 during daylight savings time. If set to true however, this compensation is skipped.
Return values
intfetchUserinfo()
Fetches an array containing info for the specified user, or false if user is not found
public
fetchUserinfo([mixed $userid = false ][, mixed $option = [] ][, mixed $languageid = false ][, mixed $nocache = false ]) : array<string|int, mixed>
Values for Option parameter: avatar - Acts as both avatarinfo and avatardata and should be considered deprecated. avatarinfo - Get avatar information avatardata - Get the binary filedata / local file path for the 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 isfriend - Is the logged in User a friend of this person? Therefore: ['avatar', 'location'] means 'Get avatar' and 'Process online location'
Parameters
- $userid : mixed = false
- $option : mixed = []
- $languageid : mixed = false
- $nocache : mixed = false
Return values
array<string|int, mixed> —The information for the requested user
fetchUserName()
Fetches the username for a userid, or false if user is not found
public
fetchUserName(mixed $userid) : string
Parameters
- $userid : mixed
Return values
stringfetchUsernames()
Returns an array with the usernames for the user ids and optionally the profileUrl for the user
public
fetchUsernames(array<string|int, mixed> $userIds[, bool $profileUrl = true ]) : array<string|int, mixed>
Parameters
- $userIds : array<string|int, mixed>
- $profileUrl : bool = true
-
- if true include the profileUrl field in the returned array.
Return values
array<string|int, mixed> —-- [$userid => ['username' => $username, 'profileUrl' => $profileUrl]]
fetchUserProfileFields()
This gets the current user profile fields from the database.
public
fetchUserProfileFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The title of the existing user profile fields.
fetchUserSettings()
Fetches the needed info for user settings
public
fetchUserSettings([mixed $userid = false ]) : mixed
Parameters
- $userid : mixed = false
fetchUsersPms()
Fetch private messages statistics from all the users.
public
fetchUsersPms([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Used for admincp - usertools private message statistics
Parameters
- $options : array<string|int, mixed> = []
-
Set of options such as pagination, total pms filter.
- total int-- if given filter results as users for a given total
- sortby string -- field to sort results current valid values are (username, total)
- sortdir string -- ASC or DESC. Only used if sortby is set. If not given will default to ASC
Return values
array<string|int, mixed> —$result Private messages grouped by userid (including some userinfo and pm total count).
find()
Find user
public
find(array<string|int, mixed> $user, array<string|int, mixed> $profile, string $orderby, string $direction[, int $limitstart = 0 ][, int $limitnumber = 25 ]) : bool|array<string|int, mixed>
Parameters
- $user : array<string|int, mixed>
-
An array of common conditions for user search
- $profile : array<string|int, mixed>
-
An array of user profile field conditions for user search
- $orderby : string
-
Order by
- $direction : string
-
Order direction
- $limitstart : int = 0
-
Limit start
- $limitnumber : int = 25
-
Limit number
Return values
bool|array<string|int, mixed> —False if no user found. Otherwise it returns users array as result. The array also contains a field that stores total found user count.
generateMailingList()
Generates users mailing list for the given criteria.
public
generateMailingList(array<string|int, mixed> $user, mixed $profile[, mixed $options = [] ]) : bool|array<string|int, mixed>
Used for admincp - email sending and list generating.
Parameters
- $user : array<string|int, mixed>
-
An array of common conditions for user search @param array $profile An array of user profile field conditions for user search @param array $options Set of options such as activation info and pagination.
- $profile : mixed
- $options : mixed = []
Return values
bool|array<string|int, mixed> —False if no user found. Otherwise it returns users array as result. The array also contains a field that stores total found user's e-mail count.
getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
getAutocomplete()
Returns suggested usernames for the username autocomplete popup menu.
public
getAutocomplete(mixed $searchStr[, mixed $orderby = 'username' ][, mixed $direction = 'ASC' ][, mixed $limitstart = 0 ][, mixed $limitnumber = 15 ]) : array<string|int, mixed>
Parameters
- $searchStr : mixed
- $orderby : mixed = 'username'
- $direction : mixed = 'ASC'
- $limitstart : mixed = 0
- $limitnumber : mixed = 15
Return values
array<string|int, mixed> —Array containing one element "suggestions" which is an array. Each element is an array containing: 'title' => username without html entities 'value' => username 'id' => userid
getCanCreate()
This is a wrapper for userContext getCanCreate- it returns the content types a user can create
public
getCanCreate(int $nodeid) : array<string|int, mixed>
Parameters
- $nodeid : int
Return values
array<string|int, mixed> —-- types the user can create in that node
getGitCanStart()
This likes the channels below a parent node where a user can create starters based on groupintopic
public
getGitCanStart(int $parentNodeId) : array<string|int, mixed>
Parameters
- $parentNodeId : int
-
-- the ancestor node id
Return values
array<string|int, mixed> —array of integer, title- the nodeids
getGroupInTopic()
This returns a user's additional permissions from the groupintopic table
public
getGroupInTopic([int $userid = false ][, int $nodeid = false ][, bool $forceReload = false ]) : array<string|int, mixed>
Parameters
- $userid : int = false
- $nodeid : int = false
-
-- optional
- $forceReload : bool = false
-
-- optional defaults to false
Return values
array<string|int, mixed> —-- Array of ['nodeid' => nodeid, 'groupid' => groupid];
getIpLocation()
Return the location for the current user's IP address
public
getIpLocation() : mixed
Tags
getNamecardInfo()
public
getNamecardInfo(mixed $userid) : mixed
Parameters
- $userid : mixed
getNamecardInfoBulk()
public
getNamecardInfoBulk(mixed $userids) : mixed
Parameters
- $userids : mixed
getPersonalData()
Returns a report on "personal information" for a user
public
getPersonalData([mixed $userid = 0 ]) : array<string|int, mixed>
This is the personally identifiable information for privacy laws. Currently this follows our best understanding of the EU law, but eventually this may end up being a superset of all simpilar laws.
Parameters
- $userid : mixed = 0
-
(optional)
Return values
array<string|int, mixed> —of information. See the library function for full listing.
getUsersFromCriteria()
Fetch users and info from a given user criteria Used for admincp - verticalresponse.
public
getUsersFromCriteria(mixed $user, array<string|int, mixed> $profile[, mixed $options = [] ]) : array<string|int, mixed>
@param array $user An array of common conditions for user search
Parameters
- $user : mixed
- $profile : array<string|int, mixed>
-
An array of user profile field conditions for user search @param array $options Set of options such as activation info and pagination.
- $options : mixed = []
Return values
array<string|int, mixed> —$result Result which includes the 'users' => userlist and the 'totalcount'.
hasPermissions()
Returns global permission value or specific value for a nodeid for current user.
public
hasPermissions(string $group, string $permission[, bool $nodeid = false ]) : bool|int
Parameters
- $group : string
- $permission : string
- $nodeid : bool = false
-
(optional)
Return values
bool|inthavePermissions()
Returns permission values of a group of nodes for current user.
public
havePermissions(string $group, string $permission[, array<string|int, mixed> $nodeIds = [] ]) : bool|int
Parameters
- $group : string
- $permission : string
- $nodeIds : array<string|int, mixed> = []
Tags
Return values
bool|intignoreUser()
public
ignoreUser(mixed $userid[, mixed $add = true ]) : mixed
Parameters
- $userid : mixed
- $add : mixed = true
instance()
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
public
static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiinstanceInternal()
Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
public
static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_ApiinviteMembers()
Invites members to a given node channel passing either an array of userids or usernames.
public
inviteMembers(mixed $userIds, array<string|int, mixed>|string $userNames, int $nodeId, string $requestType) : mixed
Will combine the list of username with the list of userids to get the list of users to invite.
Parameters
- $userIds : mixed
- $userNames : array<string|int, mixed>|string
- $nodeId : int
- $requestType : string
-
-- Either 'member_to' (blogs) or 'sg_member_to' (social groups)
isBanned()
Check whether a user is banned.
public
isBanned(int $userid) : bool
Parameters
- $userid : int
-
User ID.
Return values
bool —Whether the user is banned.
isBannedEmail()
Check whether an email address is banned from the forums
public
isBannedEmail(string $email) : bool
Parameters
- $email : string
-
The email address to check
Return values
bool —Whether the email is banned.
isIgnoringUser()
public
isIgnoringUser(mixed $userid[, mixed $nocache = false ]) : mixed
Parameters
- $userid : mixed
- $nocache : mixed = false
isMfaEnabled()
Gets whether or not the user has an enabled MFA record
public
isMfaEnabled(int $userid) : mixed
Requires canadminusers permission
Parameters
- $userid : int
-
@return array -- bool enabled
killActivation()
public
killActivation(mixed $userid, mixed $activateid) : mixed
Parameters
- $userid : mixed
- $activateid : mixed
login()
Login a user
public
login(string $username[, string $password = null ][, string $md5password = null ][, mixed $md5password_utf = null ][, string $logintype = null ]) : array<string|int, mixed>
use login2
Parameters
- $username : string
- $password : string = null
- $md5password : string = null
- $md5password_utf : mixed = null
- $logintype : string = null
Return values
array<string|int, mixed> —'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"
login2()
Login a user
public
login2(string $username, array<string|int, mixed> $passwords, array<string|int, mixed> $extraAuthInfo[, string $logintype = '' ]) : array<string|int, mixed>
Parameters
- $username : string
- $passwords : array<string|int, mixed>
-
-- contains at least one of
- string password -- plain text password
- string md5password -- md5 encoded password (legacy)
- string md5password_utf -- md5 encoded password with utf replacements (legacy)
- $extraAuthInfo : array<string|int, mixed>
-
-- information that might be required to authorize a user, such as numeric code for MFA
- $logintype : string = ''
Return values
array<string|int, mixed> —'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"
loginExternal()
Log in via a third party provider.
public
loginExternal(string $provider, array<string|int, mixed> $info[, int $userid = null ]) : mixed
For now facebook is the only provider supported. We do not support control panel logins via external providers.
Parameters
- $provider : string
-
. Currently ignored, should be passed as 'facebook' since that is the only provider recognized.
- $info : array<string|int, mixed>
-
. The various information needed for the provider to log in. One of 'token' or 'signedrequest' must be provided. If both are then 'token' will be tried first.
- 'token' string the facebook access/oAuth token. (optional)
- 'signedrequest' string the facebook signedrequest. this is a one use token that can be used to retrieve the auth token. (optional)
- $userid : int = null
-
. If given we will only log in the requested userid. This prevents weirdness where the front end has an FB token that does not belong to the user the front end thinks is logged in (it's very difficult to figure out which user the token belongs to).
Tags
loginSpecificUser()
Login a user for which we have the userid
public
loginSpecificUser(int $userid, array<string|int, mixed> $passwords, array<string|int, mixed> $extraAuthInfo[, string $logintype = '' ]) : array<string|int, mixed>
Parameters
- $userid : int
- $passwords : array<string|int, mixed>
-
-- contains at least one of
- string password -- plain text password
- string md5password -- md5 encoded password (legacy)
- string md5password_utf -- md5 encoded password with utf replacements (legacy)
- $extraAuthInfo : array<string|int, mixed>
-
-- information that might be required to authorize a user, such as numeric code for MFA
- $logintype : string = ''
Return values
array<string|int, mixed> —'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token". A value that can be used to create a new session without the user explicitly logging in 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => value needed to access the admincp. Defines being logged in "as an admin"
logout()
Logout user
public
logout([mixed $logouthash = null ]) : bool
Parameters
- $logouthash : mixed = null
-
Logout hash
Return values
boollogoutAllDevices()
Logout user from all devices.
public
logoutAllDevices([string|null $logouthash = null ]) : array{success: bool, sessionhash: string, apiaccesstoken: string}
Parameters
- $logouthash : string|null = null
Return values
array{success: bool, sessionhash: string, apiaccesstoken: string} —sessionhash -- hash identifying the new session, if logging out the current user. apiaccesstoken -- the current api access token, if logging out the current user and this is a request through MAPI
map_vb4_input_to_vb5()
Returns vb5 api method name.
public
static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string
May alter request array.
Parameters
- $method : string
-
-- vb4 method name
- $request : array<string|int, mixed>
-
-- $_REQUEST array for this api request
Return values
stringmap_vb5_errors_to_vb4()
Alters the error array in any way necessary to interface correctly with vb4.
public
static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- error array from vb5
map_vb5_output_to_vb4()
Alters the output array in any way necessary to interface correctly with vb4.
public
static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- output array from vb5
memberList()
Fetch a list of user based on the provided criteria
public
memberList([array<string|int, mixed> $criteria = [] ]) : array<string|int, mixed>
Will only return a user if their primary user group has the viewable on the memberslist option set.
Parameters
- $criteria : array<string|int, mixed> = []
-
values for criteria: int $pagenumber the page to start from int $perpage number of members to display on a page string $sortfield the foeld to sort by string $sortorder the sort order (asc/desc) string $startswith the first letter(s) the username should match
Return values
array<string|int, mixed> —members - the list of members that match the criteria pagingInfo - pagination information
merge()
Merge two users
public
merge(int $sourceuserid, int $destuserid) : mixed
Parameters
- $sourceuserid : int
- $destuserid : int
needMFA()
Indicates if the current user needs to provide an MFA code for login.
public
needMFA(string $logintype) : array<string|int, mixed>
Note that it's not entirely pointless to request this for a logged in user as we can still require a login for a cpsession even after a user is logged in.
Parameters
- $logintype : string
-
-- either '', 'cplogin', 'modcplogin', 'mfareset' mfareset is a psuedo login where we reauthorize the login in order to change the mfa code.
Return values
array<string|int, mixed> —-- bool enabled -- true if MFA auth is needed, false if not
needsCoppa()
This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call
public
needsCoppa(array<string|int, mixed> $dateInfo) : int
Parameters
- $dateInfo : array<string|int, mixed>
-
-- array of month/day/year.
Return values
int —0 - no COPPA needed, 1 - Approve but require adult validation, 2 - Deny
prune()
Do prune/move users (step 1)
public
prune(array<string|int, mixed> $userids, string $dowhat[, int $movegroup = 0 ]) : mixed
Parameters
- $userids : array<string|int, mixed>
-
UserID to be pruned or moved
- $dowhat : string
-
'delete' or 'move'
- $movegroup : int = 0
-
Usergroup ID that the users are going to be moved
registerNeedAvatarForUsers()
Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.
public
registerNeedAvatarForUsers(mixed $userids) : mixed
Parameters
- $userids : mixed
resetMfaSecret()
Reset the current user's MFA secret
public
resetMfaSecret(string $password[, string $mfa_authcode = null ]) : mixed
Parameters
- $password : string
-
-- the user's current password
- $mfa_authcode : string = null
-
-- the authcode for the current secret, not required if the user does not currently have an auth secret
save()
Insert or Update an user
public
save(int $userid, string $password, array<string|int, mixed> $user, array<string|int, mixed> $options, array<string|int, mixed> $adminoptions, array<string|int, mixed> $userfield[, array<string|int, mixed> $notificationOptions = [] ][, array<string|int, mixed> $hvinput = [] ][, array<string|int, mixed> $extra = [] ][, array<string|int, mixed> $moderatorNotificationOptions = [] ][, array<string|int, mixed> $moderatorEmailNotificationOptions = [] ]) : int
Parameters
- $userid : int
-
Userid to be updated. Set to 0 if you want to insert a new user.
- $password : string
-
Password for the user. Empty means no change. May be overriden by the $extra array
- $user : array<string|int, mixed>
-
Basic user information such as email or home page * username * email * usertitle * birthday * usergroupid (will get no_permissions exception without administrate user permissions) * membergroupids (will get no_permissions exception without administrate user permissions)
- privacyconsent int -1|0|1 meaning Privacy-Consent Withdrawn|Unknown|Given respectively.
- list not complete
- $options : array<string|int, mixed>
-
vB options for the user
- $adminoptions : array<string|int, mixed>
-
Admin Override Options for the user
- $userfield : array<string|int, mixed>
-
User's User Profile Field data
- $notificationOptions : array<string|int, mixed> = []
- $hvinput : array<string|int, mixed> = []
-
Human Verify input data. @see vB_Api_Hv::verifyToken()
- $extra : array<string|int, mixed> = []
-
Generic flags or data to affect processing.
- newpass
- password
- acnt_settings => 1 if we are editing the user as a normal user (suppresses adminoverride if the user is an admin. This is really misnamed and only treats the request as from a normal user even if the user is an admin.
- fbautoregister => true if we are using the FB quick registration. This skips some checks such as the HV if we actually have a facebook account
- $moderatorNotificationOptions : array<string|int, mixed> = []
- $moderatorEmailNotificationOptions : array<string|int, mixed> = []
Return values
int —New or updated userid.
saveEditorState()
Saves the content entry UI editor "state" where state is the show/hide state of the following 3 content entry UIs: ckeditor toolbar, attachements panel, and smilies panel.
public
saveEditorState(mixed $action, mixed $value) : array<string|int, mixed>
Parameters
- $action : mixed
- $value : mixed
Return values
array<string|int, mixed> —Array containing success and the current editor state
saveProfileFieldDefinition()
public
saveProfileFieldDefinition(mixed $profilefield) : mixed
Parameters
- $profilefield : mixed
saveSignature()
Verifies and saves a signature for current logged in user. Returns the signature.
public
saveSignature(string $signature[, array<string|int, mixed> $filedataids = [] ]) : string
Parameters
- $signature : string
- $filedataids : array<string|int, mixed> = []
Return values
stringsearchIP()
Search IP Addresses
public
searchIP(string $userid[, int $depth = 1 ]) : array<string|int, mixed>
Parameters
- $userid : string
-
An userid. Find IP Addresses for user.
- $depth : int = 1
-
Depth to Search
Return values
array<string|int, mixed> —'regip' User's registration IP. 'postips' IP addresses which the user has ever used to post 'regipusers' Other users who used the same IP address to register
searchUsersByIP()
Search IP Addresses
public
searchUsersByIP(string $ipaddress, int $depth) : array<string|int, mixed>
Parameters
- $ipaddress : string
-
An IP Address. Find Users by IP Address.
- $depth : int
-
Search depth
Return values
array<string|int, mixed> —'postipusers' Users who used the IP address to post 'regipusers' Users who used the IP address to register
sendActivateEmail()
public
sendActivateEmail(mixed $email) : mixed
Parameters
- $email : mixed
setCurrentUserPrivacyConsent()
Set privacy consent and for the current user if needed.
public
setCurrentUserPrivacyConsent() : mixed
setDefaultAvatar()
This sets a user to use one of the default avatars.
public
setDefaultAvatar(int $avatarid) : mixed
Parameters
- $avatarid : int
Tags
setGroupInTopic()
This grants a user additional permissions in a specific channel, by adding to the groupintopic table
public
setGroupInTopic(int $userid, array<string|int, mixed>|int $nodeids, int $usergroupid) : bool
Parameters
- $userid : int
- $nodeids : array<string|int, mixed>|int
- $usergroupid : int
Return values
boolsetMfaEnabled()
Sets the users MFA record to enabled or disabled
public
setMfaEnabled(int $userid, bool $enabled) : mixed
Requires canadminusers permission
Parameters
- $userid : int
- $enabled : bool
Tags
setNewPassword()
Set a new password for a user. Used by "forgot password" function.
public
setNewPassword(int $userid, string $activationid, string $newpassword) : array<string|int, string>
Parameters
- $userid : int
- $activationid : string
-
Activation ID
- $newpassword : string
Return values
array<string|int, string> —keys 'password_reset' & 'setnewpw_message', values
unixtimestampToUserDateString()
public
unixtimestampToUserDateString(mixed $timestamp[, mixed $userid = false ][, mixed $format = "Y-m-d H:i:s" ][, mixed $ignoreDST = true ][, mixed $locale = '' ]) : mixed
Parameters
- $timestamp : mixed
- $userid : mixed = false
- $format : mixed = "Y-m-d H:i:s"
- $ignoreDST : mixed = true
- $locale : mixed = ''
unsetGroupInTopic()
This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table
public
unsetGroupInTopic(int $userid, array<string|int, mixed>|int $nodeids, mixed $usergroupid) : bool
Parameters
- $userid : int
-
user for whom we are unsetting GIT records
- $nodeids : array<string|int, mixed>|int
-
(integer or array of integers) nodeid(s) of the GIT record(s) to unset @param int $usergroupid usergroupid of the GIT record to unset
- $usergroupid : mixed
Return values
boolupdateGuestPrivacyConsent()
Updates guest privacy consent
public
updateGuestPrivacyConsent(mixed $consent) : mixed
Parameters
- $consent : mixed
updateStatus()
Updates the user status
public
updateStatus(mixed $userid, mixed $status) : string
Parameters
- $userid : mixed
- $status : mixed
Return values
string —Updated status from user.
useCoppa()
This checks whether the site uses COPPA review
public
useCoppa() : bool
Return values
booluserTimeStrToUnixtimestamp()
public
userTimeStrToUnixtimestamp(mixed $strTime[, mixed $userid = false ][, mixed $ignoreDST = true ]) : mixed
Parameters
- $strTime : mixed
- $userid : mixed = false
- $ignoreDST : mixed = true
vBMktime()
translate a year/month/day/hour/minute to a Unix timestamp.
public
vBMktime(array<string|int, mixed> $dateInfo) : int
Parameters
- $dateInfo : array<string|int, mixed>
-
-- array of year, month, day, hour, minute, second. Year and month are required.
Return values
int —-- Unix Timestamp, corrected for the user's time setting
verifyFlashMessageSignature()
Verifies that a flash message passed through the URL is signed and valid
public
verifyFlashMessageSignature(mixed $phrase, mixed $timestamp, mixed $hash) : array<string|int, mixed>
Parameters
- $phrase : mixed
- $timestamp : mixed
- $hash : mixed
Return values
array<string|int, mixed> —Returns success=>true in the array if the message is valid.