class vB_Api_User extends vB_Api

vB_Api_User

Traits

Constants

USERINFO_AVATAR

USERINFO_PROFILEPIC

USERINFO_ADMIN

USERINFO_SIGNPIC

USERINFO_ISFRIEND

DEFAULT_AVATAR_PATH_REGULAR

DEFAULT_AVATAR_PATH_THUMB

DEFAULT_AVATAR_PATH_LARGE

Properties

protected bool $disabled Indicates whether the API was disabled from vB_Api
protected $disableWhiteList
protected $disableFalseReturnOnly
protected string $controller API Controller from vB_Api
protected vB_Database $db Database object. from vB_Api
protected $users
protected $groupInTopic
protected $moderatorsOf
protected $membersOf
protected $permissionContext
protected $referrals
protected $avatarsCache
protected $avatarUserCache
protected $usertitleCache
protected $privacyOptions
protected $library
protected array $pendingAvatarUserids An array of userids to batch-fetch avatar information for.
protected array $loadedAvatarUserids Array of userids that have already been used to batch-fetch avatar information

Methods

__sleep()

No description

__wakeup()

No description

static 
getApiClassName($controller)

No description

from vB_Api
static 
getApiClassNameInternal($controller)

No description

from vB_Api
static 
getApiClass($controller, $errorCheck = true)

No description

from vB_Api
static vB_Api
instanceInternal(string $controller, bool $refresh_cache = false)

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

from vB_Api
static vB_Api
instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

from vB_Api
static 
clearCache()

Clears all previously loaded API objects.

from vB_Api
The
callNamed()

Call the given api function by name with a named arguments list.

from vB_Api
static string
map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

from vB_Api
static 
map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

from vB_Api
static 
map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

from vB_Api
__construct()

Constructor

checkApiState($method)

This method checks whether the API method is enabled.

from vB_Api
bool
isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

from vB_Api
bool
isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

from vB_Api
toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

from vB_Api
none
checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
boolean
hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

from vB_Api
checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

from vB_Api
setController(string $controller)

Set controller

from vB_Api
inDebugMode()

No description

from vB_Api
array
fetchProfileInfo(int $userid = false)

This gets the information needed for a user's profile. Only public information unless this is an admin or the user.

setCurrentUserFlags($userInfo)

Set current user flags to display or not certain user items.

fetchUserSettings($userid = false)

Fetches the needed info for user settings

array
fetchUserinfo(integer $userid = false, array $option = array(), integer $languageid = false, boolean $nocache = false)

Fetches an array containing info for the specified user, or false if user is not found

array
fetchCurrentUserinfo()

Fetches an array containing info for the current user

string
fetchUserName(integer $userid)

Fetches the username for a userid, or false if user is not found

string
fetchMusername(array $user, string $displaygroupfield = 'displaygroupid', string $usernamefield = 'username')

fetches the proper username markup and title

array
fetchByUsername(string $username, array $option = array())

Fetch user by its username

array
fetchByEmail(string $email, array $option = array())

Fetch user by its email

array
memberList(array $criteria = array())

Fetch a list of user based on the provided criteria

bool
find(array $user, array $profile, string $orderby, string $direction, integer $limitstart = 0, integer $limitnumber = 25)

Find user

array
getGroupInTopic(int $userid = false, int $nodeid = false, boolean $forceReload = false)

This returns a user's additional permissions from the groupintopic table

array
getModeratorsOf(int $userid = false)

Returns a list of channels where this user is moderator

array
getMembersOf(int $userid = false)

Returns a list of channels where this user is moderator

array
getCanCreate(int $nodeid)

This is a wrapper for userContext getCanCreate- it returns the content types a user can create

computeMembersOf(int $userid)

Analyzes what groups this user belongs to in specific channels. Stores in member variables

bool
setGroupInTopic(int $userid, array|int $nodeids, int $usergroupid)

This grants a user additional permissions in a specific channel, by adding to the groupintopic table

bool
unsetGroupInTopic($userid, $nodeids, $usergroupid)

This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table

clearChannelPerms(int $userid)

This method clears remembered channel permission

registerNeedAvatarForUsers(array $userids)

Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.

array
fetchAvatar($userid, $thumb = false, $userinfo = array())

Fetches the URL for a User's Avatar

array
fetchAvatars(array $userids = array(), boolean $thumb = false, array $userinfo = array())

Fetch the Avatars for a userid array

array
fetchProfileFieldsForRegistration(array $userinfo = array())

Fetches the Profile Fields that needs to be displayed in Registration From

void
_processProfileFields(array $profilefields, array $currentvalues)

Process Profile Fields for templates

delete(integer $userid, bool $transfer_groups = true)

Delete a user

integer
saveEmailPassword(array $extra)

Shortcut to saving only email and password if user only has permission to modify password and email

integer
save(integer $userid, string $password, array $user, array $options, array $adminoptions, array $userfield, array $notificationOptions = array(), array $hvinput = array(), array $extra = array())

Insert or Update an user

sendActivateEmail($email)

No description

string
activateUserByUsername(string $username, string $activateid)

Activate an user with an activate ID and Username

string
activateUser(int $userid, string $activateid)

Activate an user with an activate ID

deleteActivation($userid, $activateid)

No description

killActivation($userid, $activateid)

No description

string
saveSignature(string $signature, array $filedataids = array())

Verifies and saves a signature for current logged in user. Returns the signature.

array
fetchAwaitingModerate()

Fetch a list of users who are awaiting moderate or Coppa

bool
moderate(array $validate, bool $send_validated, bool $send_deleted)

Moderate users

array
fetchPruneUsers(integer $usergroupid, integer $daysprune, integer $minposts, array $joindate, string $order)

Return a list of users for pruning or moving

prune(array $userids, string $dowhat, integer $movegroup = 0)

Do prune/move users (step 1)

integer
pruneUpdateposts(integer $startat)

Do prune/move users (step 2). Userids to be updated are stored in adminutil table.

array
changeHistory(integer $userid)

Return user change history

merge(integer $sourceuserid, integer $destuserid)

Merge two users

updateAvatar($userid, $avatarid, $data = array(), $cropped = false)

Update avatar

updateSigPic(integer $userid, bool $delete, array $data = array())

Update profile picture

array
getPrivacyConsentRequired()

Return if the privacy consent is required for the current session

array
searchIP(string $userid, integer $depth = 1)

Search IP Addresses

array
searchUsersByIP(string $ipaddress, integer $depth)

Search IP Addresses

_searchRegisterIP($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_register_table()

_searchUserIP($userid, $previpaddress, $depth = 2)

Rewrite function construct_user_ip_table()

_searchIPUsage($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_usage_table()

array
fetchReferrers(array $startdate, array $enddate)

Return a report of referrers

bool
isBanned(integer $userid)

Check whether a user is banned.

bool
isBannedEmail(string $email)

Check whether an email address is banned from the forums

resetMfaSecret(string $password, string $mfa_authcode = null)

Reset the current user's MFA secret

enableMfa(string $password, string $mfa_authcode)

Enable the user's current MFA record after verify password and authcode

array
setMfaEnabled(int $userid, bool $enabled)

Sets the users MFA record to enabled or disabled

isMfaEnabled(int $userid)

Gets whether or not the user has an enabled MFA record

array
needMFA(string $logintype)

Indicates if the current user needs to provide an MFA code for login.

array
login($username, $password = null, $md5password = null, $md5password_utf = null, $logintype = null) deprecated

Login a user

array
login2(string $username, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user

array
loginSpecificUser(int $userid, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user for which we have the userid

array.
loginExternal($provider, $info, $userid = null)

Log in via a third party provider.

bool
logout($logouthash = null)

Logout user

bool
emailPassword(integer $userid, string $email, array $hvinput = array())

Email user a password reset email

string[]
setNewPassword(integer $userid, string $activationid, string $newpassword)

Set a new password for a user. Used by "forgot password" function.

processPasswordResetLockout($userinfo, $useractivation, $activationid)

No description

int
needsCoppa(array $dateInfo)

This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call

bool
useCoppa()

This checks whether the site uses COPPA review

bool
checkUsername(username $candidate)

This checks whether the a username is available and valid

currentUserHasAdminPermission($adminPermission)

No description

array
getAutocomplete(string $searchStr, string $orderby = 'username', string $direction = 'ASC', int $limitstart = 0, int $limitnumber = 15)

Returns suggested usernames for the username autocomplete popup menu.

setDefaultAvatar(int $avatarid)

This sets a user to use one of the default avatars.

fetchUserSearchCondition($user, $profile, $prefix = 'user')

Convert the search array to the assertor conditions.

array
fetchSignature(int $userid)

Get the profile information so the presentation can render it

getProfileFieldConditions($profilefield, $profile)

No description

array
fetchBirthdays()

Fetch today's birthdays

array
fetchUsernames(array $userIds, bool $profileUrl = true)

Returns an array with the usernames for the user ids and optionally the profileUrl for the user

updateIgnorelist(int $userid, String[] $userList)

Updates the user ignore list

String
updateStatus(int $userid = false, String $status)

Updates the user status

banUsers(array $userids, int $banusergroupid, string $period, string $reason = '')

Ban users

boolean|int
hasPermissions(string $group, string $permission, boolean $nodeid = false)

Returns global permission value or specific value for a nodeid for current user.

integer
canRemovePost(integer $nodeid)

Checks the various options as to whether the current user can physically remove a post

boolean|int
havePermissions(string $group, string $permission, array $nodeIds = array())

Returns permission values of a group of nodes for current user.

inviteMembers($userIds, $userNames, $nodeId, $requestType)

Invites members to a given node channel passing either an array of userids or usernames.

bool
generateMailingList($user, $profile, $options = array())

Generates users mailing list for the given criteria.

array
getUsersFromCriteria($user, $profile, $options = array())

Fetch users and info from a given user criteria Used for admincp - verticalresponse.

array
fetchUsersPms($options = array())

Fetch private messages statistics from all the users.

fetchAdminUser()

This implements vB_PermissionContext::getAdminUser().

array
fetchUserProfileFields()

This gets the current user profile fields from the database.

string
getUsertitleFromPosts(int $posts)

Get the user title regarding the given posts.

array
getPrivacyOptions()

Mostly a getter for user privacy options.

array
getGitCanStart(int $parentNodeId)

This likes the channels below a parent node where a user can create starters based on groupintopic

1
canCreateBlogEntry(int $nodeid = 0)

Tells whether the current user can create a blog entry. That can be their own permissions or GIT.

integer
fetchTimeOffset($adjustForServer = false, $userid = false, $ignoreDST = false)

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.

integer
vBMktime(array $dateInfo)

translate a year/month/day/hour/minute to a Unix timestamp.

userTimeStrToUnixtimestamp($strTime, $userid = false, $ignoreDST = true)

No description

unixtimestampToUserDateString($timestamp, $userid = false, $format = "Y-m-d H:i:s", $ignoreDST = true)

No description

updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

setPrivacyConsent(int $userid, array $data = array())

Set privacy consent and eu status for user

array
getPersonalData($userid = 0)

Returns a report on "personal information" for a user

array
verifyFlashMessageSignature(string $phrase, string $timestamp, string $hash)

Verifies that a flash message passed through the URL is signed and valid

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Api at line 63
static getApiClassName($controller)

Parameters

$controller

in vB_Api at line 69
static protected getApiClassNameInternal($controller)

Parameters

$controller

in vB_Api at line 97
static protected getApiClass($controller, $errorCheck = true)

Parameters

$controller
$errorCheck

in vB_Api at line 177
static vB_Api instanceInternal(string $controller, bool $refresh_cache = false)

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

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 203
static vB_Api instance(string $controller, bool $refresh_cache = false)

Returns an instance of the API object which translates exceptions to an array Use this method for API clients.

Parameters

string $controller -- name of the API controller to load
bool $refresh_cache -- true if we want to force the cache to update with a new api object primarily intended for testing

Return Value

vB_Api

in vB_Api at line 237
static clearCache()

Clears all previously loaded API objects.

Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.

in vB_Api at line 259
The callNamed()

Call the given api function by name with a named arguments list.

Used primarily to translate REST requests into API calls.

Return Value

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.

in vB_Api at line 313
static string map_vb4_input_to_vb5(string $method, array $request)

Returns vb5 api method name.

May alter request array.

Parameters

string $method -- vb4 method name
array $request -- $_REQUEST array for this api request

Return Value

string

in vB_Api at line 497
static map_vb5_output_to_vb4(string $method, array $data)

Alters the output array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- output array from vb5

in vB_Api at line 545
static map_vb5_errors_to_vb4(string $method, array $data)

Alters the error array in any way necessary to interface correctly with vb4.

Parameters

string $method -- vb4 method name
array $data -- error array from vb5

at line 84
protected __construct()

Constructor

in vB_Api at line 631
checkApiState($method)

This method checks whether the API method is enabled.

For extensions check make sure $controller property is already set.

Parameters

$method

in vB_Api at line 657
protected bool isWhiteListed(string $method)

Checks if method is white listed when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method is or is not a white list.

in vB_Api at line 685
protected bool isDisableFalseReturnOnly(string $method)

Checks if method returns false response only when API is disabled.

Parameters

string $method API method to check.

Return Value

bool Indicates whether method returns false response only.

in vB_Api at line 712
protected toSeoFriendly(string $str)

Replaces special characters in a given string with dashes to make the string SEO friendly

Parameters

string $str The string to be converted

in vB_Api at line 734
protected none checkHasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission, and if not throws an exception

Checks for: * A valid CP Session * The passed adminpermission.

Parameters

string $adminPermission The admin permission to check

Return Value

none

Exceptions

inlinemodauth_required -- The current session is not a mod/admin session
nopermission_loggedin -- The user does not have the given permission
no_permission -- The user is not logged in at all.

in vB_Api at line 753
protected boolean hasAdminPermission(string $adminPermission)

Determines if the calling user has the given admin permission

Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.

Parameters

string $adminPermission The admin permission to check

Return Value

boolean true if checks pass, false otherwise

in vB_Api at line 807
protected checkIsLoggedIn()

Determines if the calling user has the given admin permission, and if not throws an exception

in vB_Api at line 821
protected setController(string $controller)

Set controller

Parameters

string $controller Controller name

in vB_Api at line 831
protected inDebugMode()

at line 96
array fetchProfileInfo(int $userid = false)

This gets the information needed for a user's profile. Only public information unless this is an admin or the user.

Parameters

int $userid -- uses the current logged in user if not given. Error if the user is a guest.

Return Value

array -- the profile information.

at line 308
protected setCurrentUserFlags($userInfo)

Set current user flags to display or not certain user items.

Parameters

$userInfo

at line 346
fetchUserSettings($userid = false)

Fetches the needed info for user settings

Parameters

$userid

at line 734
array fetchUserinfo(integer $userid = false, array $option = array(), integer $languageid = false, boolean $nocache = false)

Fetches an array containing info for the specified user, or false if user is not found

Values for Option parameter: avatar - Get avatar profilepic - Join the customprofilpic table to get the userid just to check if we have a picture 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: array('avatar', 'location') means 'Get avatar' and 'Process online location'

Parameters

integer $userid User ID
array $option Fetch Option (see description)
integer $languageid Language ID. If set to 0, it will use user-set languageid (if exists) or default languageid
boolean $nocache If true, the method won't use user cache but fetch information from DB.

Return Value

array The information for the requested user

at line 773
array fetchCurrentUserinfo()

Fetches an array containing info for the current user

Return Value

array The information for the requested user. Userinfo record plus language information

at line 813
string fetchUserName(integer $userid)

Fetches the username for a userid, or false if user is not found

Parameters

integer $userid User ID

Return Value

string

at line 831
string fetchMusername(array $user, string $displaygroupfield = 'displaygroupid', string $usernamefield = 'username')

fetches the proper username markup and title

Parameters

array $user User info array
string $displaygroupfield Name of the field representing displaygroupid in the User info array
string $usernamefield Name of the field representing username in the User info array

Return Value

string Username with markup and title

at line 845
array fetchByUsername(string $username, array $option = array())

Fetch user by its username

Parameters

string $username Username
array $option Fetch Option (see description of fetchUserinfo())

Return Value

array The information for the requested user

at line 885
array fetchByEmail(string $email, array $option = array())

Fetch user by its email

Parameters

string $email Email
array $option Fetch Option (see description of fetchUserinfo())

Return Value

array The information for the requested user

at line 915
array memberList(array $criteria = array())

Fetch a list of user based on the provided criteria

Parameters

array $criteria 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 Value

array members - the list of members that match the criteria pagingInfo - pagination information

at line 991
bool find(array $user, array $profile, string $orderby, string $direction, integer $limitstart = 0, integer $limitnumber = 25)

Find user

Parameters

array $user An array of common conditions for user search
array $profile An array of user profile field conditions for user search
string $orderby Order by
string $direction Order direction
integer $limitstart Limit start
integer $limitnumber Limit number

Return Value

bool |array False if no user found. Otherwise it returns users array as result. The array also contains a field that stores total found user count.

at line 1040
array getGroupInTopic(int $userid = false, int $nodeid = false, boolean $forceReload = false)

This returns a user's additional permissions from the groupintopic table

Parameters

int $userid
int $nodeid -- optional
boolean $forceReload -- optional defaults to false

Return Value

array -- Array of array('nodeid' => nodeid, 'groupid' => groupid);

at line 1075
array getModeratorsOf(int $userid = false)

Returns a list of channels where this user is moderator

Parameters

int $userid

Return Value

array -- nodeids

at line 1116
array getMembersOf(int $userid = false)

Returns a list of channels where this user is moderator

Parameters

int $userid

Return Value

array -- nodeids

at line 1156
array getCanCreate(int $nodeid)

This is a wrapper for userContext getCanCreate- it returns the content types a user can create

Parameters

int $nodeid

Return Value

array -- types the user can create in that node

at line 1170
protected computeMembersOf(int $userid)

Analyzes what groups this user belongs to in specific channels. Stores in member variables

Parameters

int $userid

at line 1241
bool setGroupInTopic(int $userid, array|int $nodeids, int $usergroupid)

This grants a user additional permissions in a specific channel, by adding to the groupintopic table

Parameters

int $userid
array|int $nodeids
int $usergroupid

Return Value

bool

at line 1283
bool unsetGroupInTopic($userid, $nodeids, $usergroupid)

This removes additional permissions a user was given in a specific channel, by removing from the groupintopic table

Parameters

$userid
$nodeids
$usergroupid

Return Value

bool

at line 1362
clearChannelPerms(int $userid)

This method clears remembered channel permission

Parameters

int $userid The userid to be cleared

at line 1379
registerNeedAvatarForUsers(array $userids)

Registers userids that we will later be fetching avatars for. If we register the userids here, they can be fetched in batches.

Parameters

array $userids Array if integer user IDs for the users whose avatars we will be fetching later.

at line 1397
array fetchAvatar($userid, $thumb = false, $userinfo = array())

Fetches the URL for a User's Avatar

Parameters

$userid
$thumb
$userinfo

Return Value

array Information regarding the avatar

at line 1442
array fetchAvatars(array $userids = array(), boolean $thumb = false, array $userinfo = array())

Fetch the Avatars for a userid array

Parameters

array $userids The User IDs array
boolean $thumb Whether to get the Thumbnailed avatar or not
array $userinfo Array of userinfo, possibly already containing the avatar information

Return Value

array Information regarding the avatar

at line 1672
array fetchProfileFieldsForRegistration(array $userinfo = array())

Fetches the Profile Fields that needs to be displayed in Registration From

Parameters

array $userinfo User information as fields' current value

Return Value

array Profile fields

at line 1686
protected void _processProfileFields(array $profilefields, array $currentvalues)

Process Profile Fields for templates

Parameters

array $profilefields (ref) Profile fields (database records array) to be processed.
array $currentvalues Current values of the profile fields

Return Value

void

at line 1848
delete(integer $userid, bool $transfer_groups = true)

Delete a user

Parameters

integer $userid int The ID of user to be deleted
bool $transfer_groups boolean Whether to transfer the Groups and Blogs owned by the user to current logged-in admininstrator

at line 1877
protected integer saveEmailPassword(array $extra)

Shortcut to saving only email and password if user only has permission to modify password and email

Saves the email and password for the current logged in user.

Parameters

array $extra Generic flags or data to affect processing. *email -- email to set *newpass -- new password to set *password -- existing password to verify (we verify passwords before changing email/password)

Return Value

integer New or updated userid.

at line 1970
integer save(integer $userid, string $password, array $user, array $options, array $adminoptions, array $userfield, array $notificationOptions = array(), array $hvinput = array(), array $extra = array())

Insert or Update an user

Parameters

integer $userid Userid to be updated. Set to 0 if you want to insert a new user.
string $password Password for the user. Empty means no change. May be overriden by the $extra array
array $user 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
array $options vB options for the user
array $adminoptions Admin Override Options for the user
array $userfield User's User Profile Field data
array $notificationOptions
array $hvinput Human Verify input data. see vB_Api_Hv::verifyToken()
array $extra Generic flags or data to affect processing. * registration * email * newpass * password * acnt_settings => 1 if we are editing the user as a normal user (suppresses adminoverride if the user is an admin.

Return Value

integer New or updated userid.

at line 2939
sendActivateEmail($email)

Parameters

$email

at line 2965
string activateUserByUsername(string $username, string $activateid)

Activate an user with an activate ID and Username

Parameters

string $username Username
string $activateid Activate ID

Return Value

string User status after activation. Possible values: 1) moderateuser: user is put into moderate queue 2) emailchanged: user's email address has been updated successfully 3) registration_complete: user's registration is completed

Exceptions

vB_Exception_Api

at line 2989
string activateUser(int $userid, string $activateid)

Activate an user with an activate ID

Parameters

int $userid User ID
string $activateid Activate ID

Return Value

string User status after activation. Possible values: 1) moderateuser: user is put into moderate queue 2) emailchanged: user's email address has been updated successfully 3) registration_complete: user's registration is completed

Exceptions

vB_Exception_Api

at line 3142
deleteActivation($userid, $activateid)

Parameters

$userid
$activateid

at line 3186
killActivation($userid, $activateid)

Parameters

$userid
$activateid

at line 3279
string saveSignature(string $signature, array $filedataids = array())

Verifies and saves a signature for current logged in user. Returns the signature.

Parameters

string $signature
array $filedataids

Return Value

string

at line 3496
array fetchAwaitingModerate()

Fetch a list of users who are awaiting moderate or Coppa

Return Value

array A list of users that are awaiting moderation

at line 3510
bool moderate(array $validate, bool $send_validated, bool $send_deleted)

Moderate users

Parameters

array $validate Validate information
bool $send_validated Whether to send email to users who have been accepted
bool $send_deleted Whether to send email to users who have been deleted

Return Value

bool True if user accounts validated successfully

at line 3651
array fetchPruneUsers(integer $usergroupid, integer $daysprune, integer $minposts, array $joindate, string $order)

Return a list of users for pruning or moving

Parameters

integer $usergroupid Usergroup where the users are in. -1 means all usergroups
integer $daysprune Has not logged on for x days, 0 mean any
integer $minposts Posts is less than, 0 means any
array $joindate Join Date is Before. It's an array of 'month', 'day' and 'year'. Array means any
string $order

Return Value

array Users to be pruned or moved

at line 3674
prune(array $userids, string $dowhat, integer $movegroup = 0)

Do prune/move users (step 1)

Parameters

array $userids UserID to be pruned or moved
string $dowhat 'delete' or 'move'
integer $movegroup Usergroup ID that the users are going to be moved

at line 3724
integer pruneUpdateposts(integer $startat)

Do prune/move users (step 2). Userids to be updated are stored in adminutil table.

Parameters

integer $startat Start at index.

Return Value

integer |bool Next startat value. True means all users have been updated.

at line 3770
array changeHistory(integer $userid)

Return user change history

Parameters

integer $userid

Return Value

array |bool User change history array. False means no change history.

at line 3825
merge(integer $sourceuserid, integer $destuserid)

Merge two users

Parameters

integer $sourceuserid
integer $destuserid

at line 4158
updateAvatar($userid, $avatarid, $data = array(), $cropped = false)

Update avatar

Parameters

$userid
$avatarid
$data
$cropped

at line 4323
updateSigPic(integer $userid, bool $delete, array $data = array())

Update profile picture

Parameters

integer $userid User ID whose profile picture is going to be updated
bool $delete Whether to delete profile picture of the user
array $data Picture data. It should be an array contains the following items: 'filename', 'width', 'height', 'filedata'

at line 4411
array getPrivacyConsentRequired()

Return if the privacy consent is required for the current session

This is based on the IP address. For security reasons we do not allow lookups for users other than the current session.

Return Value

array --'required' int -- 0 unknown -- 1 Privacy Consent Required -- 2 Privacy Consent Not Required

at line 4428
array searchIP(string $userid, integer $depth = 1)

Search IP Addresses

Parameters

string $userid An userid. Find IP Addresses for user.
integer $depth Depth to Search

Return Value

array '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

at line 4466
array searchUsersByIP(string $ipaddress, integer $depth)

Search IP Addresses

Parameters

string $ipaddress An IP Address. Find Users by IP Address.
integer $depth Search depth

Return Value

array 'postipusers' Users who used the IP address to post 'regipusers' Users who used the IP address to register

at line 4484
protected _searchRegisterIP($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_register_table()

Parameters

$ipaddress
$prevuserid
$depth

at line 4514
protected _searchUserIP($userid, $previpaddress, $depth = 2)

Rewrite function construct_user_ip_table()

Parameters

$userid
$previpaddress
$depth

at line 4539
protected _searchIPUsage($ipaddress, $prevuserid, $depth = 1)

Rewrite function construct_ip_usage_table()

Parameters

$ipaddress
$prevuserid
$depth

at line 4573
array fetchReferrers(array $startdate, array $enddate)

Return a report of referrers

Parameters

array $startdate Start Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'
array $enddate End Date of the report. an array of 'year', 'month', 'day', 'hour' and 'minute'

Return Value

array Referrers information

at line 4607
bool isBanned(integer $userid)

Check whether a user is banned.

Parameters

integer $userid User ID.

Return Value

bool Whether the user is banned.

at line 4631
bool isBannedEmail(string $email)

Check whether an email address is banned from the forums

Parameters

string $email The email address to check

Return Value

bool Whether the email is banned.

at line 4738
resetMfaSecret(string $password, string $mfa_authcode = null)

Reset the current user's MFA secret

Parameters

string $password -- the user's current password
string $mfa_authcode -- the authcode for the current secret, not required if the user does not currently have an auth secret

at line 4775
enableMfa(string $password, string $mfa_authcode)

Enable the user's current MFA record after verify password and authcode

Parameters

string $password -- the user's current password
string $mfa_authcode -- the authcode for the current secret, not required if the user does not currently have an auth secret

at line 4819
array setMfaEnabled(int $userid, bool $enabled)

Sets the users MFA record to enabled or disabled

Requires canadminusers permission

Parameters

int $userid
bool $enabled

Return Value

array ('success' => true)

at line 4835
isMfaEnabled(int $userid)

Gets whether or not the user has an enabled MFA record

Requires canadminusers permission

Parameters

int $userid @return array -- bool enabled

at line 4856
array needMFA(string $logintype)

Indicates if the current user needs to provide an MFA code for login.

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

string $logintype -- either '', 'cplogin', 'modcplogin', 'mfareset' mfareset is a psuedo login where we reauthorize the login in order to change the mfa code.

Return Value

array -- bool enabled -- true if MFA auth is needed, false if not

at line 4919
array login($username, $password = null, $md5password = null, $md5password_utf = null, $logintype = null) deprecated

deprecated use login2

Login a user

Parameters

$username
$password
$md5password
$md5password_utf
$logintype

Return Value

array '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"

at line 4952
array login2(string $username, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user

Parameters

string $username
array $passwords -- 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)
array $extraAuthInfo -- information that might be required to authorize a user, such as numeric code for MFA
string $logintype

Return Value

array '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"

at line 4990
array loginSpecificUser(int $userid, array $passwords, array $extraAuthInfo, string $logintype = '')

Login a user for which we have the userid

Parameters

int $userid
array $passwords -- 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)
array $extraAuthInfo -- information that might be required to authorize a user, such as numeric code for MFA
string $logintype

Return Value

array '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"

at line 5081
array. loginExternal($provider, $info, $userid = null)

Log in via a third party provider.

For now facebook is the only provider supported. We do not support control panel logins via external providers.

Parameters

$provider
$info
$userid

Return Value

array. 'login' => array (should match the return from "login" function). Only present if the login succeeded. 'userid' => int the id of the vbulletin user logged in 'password' => string "remeber me token" will always be blank for this method 'lastvisit' 'lastactivity' 'sessionhash' => the session value used to authenticate the user on subsequent page loads 'cpsessionhash' => will never be set for this function

at line 5350
bool logout($logouthash = null)

Logout user

Parameters

$logouthash Logout hash

Return Value

bool

at line 5379
bool emailPassword(integer $userid, string $email, array $hvinput = array())

Email user a password reset email

Parameters

integer $userid User ID
string $email Email address
array $hvinput Human Verify input data. see vB_Api_Hv::verifyToken()

Return Value

bool

at line 5394
string[] setNewPassword(integer $userid, string $activationid, string $newpassword)

Set a new password for a user. Used by "forgot password" function.

Parameters

integer $userid
string $activationid Activation ID
string $newpassword

Return Value

string[] keys 'password_reset' & 'setnewpw_message', values

at line 5488
protected processPasswordResetLockout($userinfo, $useractivation, $activationid)

Parameters

$userinfo
$useractivation
$activationid

at line 5597
int needsCoppa(array $dateInfo)

This checks whether a user needs COPPA approval based on birthdate. Responds to Ajax call

Parameters

array $dateInfo -- array of month/day/year.

Return Value

int 0 - no COPPA needed, 1 - Approve but require adult validation, 2 - Deny

at line 5608
bool useCoppa()

This checks whether the site uses COPPA review

Return Value

bool

at line 5620
bool checkUsername(username $candidate)

This checks whether the a username is available and valid

Parameters

username $candidate

Return Value

bool

at line 5691
currentUserHasAdminPermission($adminPermission)

Parameters

$adminPermission

at line 5724
array getAutocomplete(string $searchStr, string $orderby = 'username', string $direction = 'ASC', int $limitstart = 0, int $limitnumber = 15)

Returns suggested usernames for the username autocomplete popup menu.

Parameters

string $searchStr Text to search for, must be at least 3 chars long.
string $orderby Sort field, default 'username'
string $direction Sort order, default 'ASC'
int $limitstart [Not used, always starts from 0] Offset to start searching from, default 0
int $limitnumber Max number of suggestions to return, default 15, max 15

Return Value

array Array containing one element "suggestions" which is an array. Each element is an array containing: 'title' => username without html entities 'value' => username 'id' => userid

at line 5798
setDefaultAvatar(int $avatarid)

This sets a user to use one of the default avatars.

Parameters

int $avatarid

at line 5834
protected fetchUserSearchCondition($user, $profile, $prefix = 'user')

Convert the search array to the assertor conditions.

Refactored from adminfunctions_user.php fetch_user_search_sql

Parameters

$user
$profile
$prefix

at line 6132
array fetchSignature(int $userid)

Get the profile information so the presentation can render it

Parameters

int $userid userid

Return Value

array | 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

at line 6185
protected getProfileFieldConditions($profilefield, $profile)

Parameters

$profilefield
$profile

at line 6262
array fetchBirthdays()

Fetch today's birthdays

Return Value

array birthday information

at line 6309
array fetchUsernames(array $userIds, bool $profileUrl = true)

Returns an array with the usernames for the user ids and optionally the profileUrl for the user

Parameters

array $userIds
bool $profileUrl
  • if true include the profileUrl field in the returned array.

Return Value

array -- array($userid => array('username' => $username, 'profileUrl' => $profileUrl))

at line 6333
protected updateIgnorelist(int $userid, String[] $userList)

Updates the user ignore list

Parameters

int $userid Update ignorelist for this user.
String[] $userList Usernames of ignored users.

at line 6461
String updateStatus(int $userid = false, String $status)

Updates the user status

Parameters

int $userid UserID
String $status Status to set

Return Value

String Updated status from user.

at line 6524
banUsers(array $userids, int $banusergroupid, string $period, string $reason = '')

Ban users

Parameters

array $userids Userids to ban
int $banusergroupid Which banned usergroup to move the users to
string $period Ban period
string $reason Ban reason

at line 6665
boolean|int hasPermissions(string $group, string $permission, boolean $nodeid = false)

Returns global permission value or specific value for a nodeid for current user.

Parameters

string $group
string $permission
boolean $nodeid (optional)

Return Value

boolean|int

at line 6695
integer canRemovePost(integer $nodeid)

Checks the various options as to whether the current user can physically remove a post

Parameters

integer $nodeid

Return Value

integer 0 or 1

at line 6739
boolean|int havePermissions(string $group, string $permission, array $nodeIds = array())

Returns permission values of a group of nodes for current user.

Parameters

string $group
string $permission
array $nodeIds

Return Value

boolean|int

See also

vB_Api_User::hasPermissions

at line 6773
inviteMembers($userIds, $userNames, $nodeId, $requestType)

Invites members to a given node channel passing either an array of userids or usernames.

Will combine the list of username with the list of userids to get the list of users to invite.

Parameters

$userIds
$userNames
$nodeId
$requestType

at line 6865
bool generateMailingList($user, $profile, $options = array())

Generates users mailing list for the given criteria.

Used for admincp - email sending and list generating.

Parameters

$user
$profile
$options

Return Value

bool |array 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.

at line 6909
array getUsersFromCriteria($user, $profile, $options = array())

Fetch users and info from a given user criteria Used for admincp - verticalresponse.

@param array $user An array of common conditions for user search

Parameters

$user
$profile
$options

Return Value

array $result Result which includes the 'users' => userlist and the 'totalcount'.

at line 6937
array fetchUsersPms($options = array())

Fetch private messages statistics from all the users.

Used for admincp - usertools private message statistics

Parameters

$options

Return Value

array $result Private messages grouped by userid (including some userinfo and pm total count).

at line 6975
fetchAdminUser()

This implements vB_PermissionContext::getAdminUser().

return int User id from a user that can administer the admincp

at line 6986
array fetchUserProfileFields()

This gets the current user profile fields from the database.

Return Value

array The title of the existing user profile fields.

at line 7011
string getUsertitleFromPosts(int $posts)

Get the user title regarding the given posts.

Parameters

int $posts Number of user posts.

Return Value

string User title.

at line 7040
array getPrivacyOptions()

Mostly a getter for user privacy options.

Return Value

array Existing user privacy options.

at line 7051
array getGitCanStart(int $parentNodeId)

This likes the channels below a parent node where a user can create starters based on groupintopic

Parameters

int $parentNodeId -- the ancestor node id

Return Value

array array of integer, title- the nodeids

at line 7065
1 canCreateBlogEntry(int $nodeid = 0)

Tells whether the current user can create a blog entry. That can be their own permissions or GIT.

Parameters

int $nodeid -- optional. If not passed will check the global blog channel.

Return Value

1 if the user can create a entry in the given channel. 0 otherwise

at line 7097
integer fetchTimeOffset($adjustForServer = false, $userid = false, $ignoreDST = false)

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.

Parameters

$adjustForServer
$userid
$ignoreDST

Return Value

integer

at line 7149
integer vBMktime(array $dateInfo)

translate a year/month/day/hour/minute to a Unix timestamp.

Parameters

array $dateInfo -- array of year, month, day, hour, minute, second. Year and month are required.

Return Value

integer -- Unix Timestamp, corrected for the user's time setting

at line 7209
userTimeStrToUnixtimestamp($strTime, $userid = false, $ignoreDST = true)

Parameters

$strTime
$userid
$ignoreDST

at line 7243
unixtimestampToUserDateString($timestamp, $userid = false, $format = "Y-m-d H:i:s", $ignoreDST = true)

Parameters

$timestamp
$userid
$format
$ignoreDST

at line 7335
updateGuestPrivacyConsent(bool $consent)

Updates guest privacy consent

Parameters

bool $consent True if consenting, false otherwise

at line 7350
setPrivacyConsent(int $userid, array $data = array())

Set privacy consent and eu status for user

Parameters

int $userid User ID
array $data Array containing one or both keys "eustatus" or "privacyconsent"

at line 7387
array getPersonalData($userid = 0)

Returns a report on "personal information" for a user

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 (optional)

Return Value

array of information. See the library function for full listing.

at line 7425
array verifyFlashMessageSignature(string $phrase, string $timestamp, string $hash)

Verifies that a flash message passed through the URL is signed and valid

Parameters

string $phrase Phrase key
string $timestamp Timestamp for the securitytoken
string $hash The hash sha1(phrase + securitytoken)

Return Value

array Returns success=>true in the array if the message is valid.